fix compile error for other os than windows

This commit is contained in:
Adrian Zürcher
2025-12-29 11:20:50 +01:00
parent 8df18a243f
commit 39fb913f87
3 changed files with 36 additions and 18 deletions

23
converter/hideWindows.go Normal file
View File

@@ -0,0 +1,23 @@
//go:build windows
package converter
import (
"syscall"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
user32 = syscall.NewLazyDLL("user32.dll")
getConsoleWindow = kernel32.NewProc("GetConsoleWindow")
showWindow = user32.NewProc("ShowWindow")
)
const SW_HIDE = 0
func hideConsole() {
hwnd, _, _ := getConsoleWindow.Call()
if hwnd != 0 {
showWindow.Call(hwnd, SW_HIDE)
}
}