Upload
This commit is contained in:
parent
e1f3fae563
commit
7770df3341
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
9
.idea/BackgroundHasselhoff.iml
Normal file
9
.idea/BackgroundHasselhoff.iml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/BackgroundHasselhoff.iml" filepath="$PROJECT_DIR$/.idea/BackgroundHasselhoff.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
2
go.sum
Normal file
2
go.sum
Normal file
@ -0,0 +1,2 @@
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
1
imgLocations.txt
Normal file
1
imgLocations.txt
Normal file
@ -0,0 +1 @@
|
||||
C:\Program Files\BackgroundHasselhoff\imgs
|
29
main.go
Normal file
29
main.go
Normal file
@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golang.org/x/sys/windows"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fileBytes, err := os.ReadFile("./imgsLocation.txt")
|
||||
if err != nil {
|
||||
fmt.Printf("Error loading dir info from ./imgsLocation.txt: %v\nPress any key to continue...", err)
|
||||
fmt.Scanln()
|
||||
os.Exit(1)
|
||||
}
|
||||
files, err := os.ReadDir(string(fileBytes))
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading images from directory %v: %v\nPress any key to continue...", string(fileBytes), err)
|
||||
fmt.Scanln()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
procSystemParamInfo := windows.NewLazyDLL("user32.dll").NewProc("SystemParametersInfoW")
|
||||
imagePath, _ := windows.UTF16PtrFromString(string(fileBytes) + `\` + strconv.Itoa(rand.Intn(len(files))+1) + ".jpg")
|
||||
procSystemParamInfo.Call(20, 0, uintptr(unsafe.Pointer(imagePath)), 0x001A)
|
||||
}
|
Loading…
Reference in New Issue
Block a user