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
}
+1
View File
@@ -24,6 +24,7 @@ var (
Kernel32 = windows.NewLazySystemDLL("kernel32.dll")
Ntdll = windows.NewLazySystemDLL("ntdll.dll")
Crypt32 = windows.NewLazySystemDLL("crypt32.dll")
User32 = windows.NewLazySystemDLL("user32.dll")
)
// CallBoolErr wraps the common "r1 == 0 means failure" Win32 convention.