aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--initappc.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/initappc.go b/initappc.go
index bd04198..4049aff 100644
--- a/initappc.go
+++ b/initappc.go
@@ -12,6 +12,8 @@ import (
func main() {
if len(os.Args) <= 1 {
+ console(false)
+ defer console(true)
startMainGUIWindows()
return
}
@@ -64,3 +66,19 @@ func main() {
}
}
}
+
+func console(show bool) {
+ var getWin = syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleWindow")
+ var showWin = syscall.NewLazyDLL("user32.dll").NewProc("ShowWindow")
+ hwnd, _, _ := getWin.Call()
+ if hwnd == 0 {
+ return
+ }
+ if show {
+ var SWRESTORE uintptr = 9
+ showWin.Call(hwnd, SWRESTORE)
+ } else {
+ var SWHIDE uintptr = 0
+ showWin.Call(hwnd, SWHIDE)
+ }
+}

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR