fix(windows): silent default dump on double-click (#591)

This commit is contained in:
Roger
2026-04-27 14:47:59 +08:00
committed by GitHub
parent 5c0b1ad5cf
commit 439ff52b02
6 changed files with 50 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
//go:build windows
package winapi
var (
procGetConsoleWindow = Kernel32.NewProc("GetConsoleWindow")
procShowWindow = User32.NewProc("ShowWindow")
)
const swHide = 0
// HideConsoleWindow hides the console window attached to the current
// process. Returns true if the window was previously visible.
func HideConsoleWindow() bool {
hwnd, _, _ := procGetConsoleWindow.Call()
if hwnd == 0 {
return false
}
prev, _, _ := procShowWindow.Call(hwnd, swHide)
return prev != 0
}