Skip to content

Commit cff501c

Browse files
committed
fix(winapi): return bool from HideConsoleWindow
Capture ShowWindow's previous-visibility return as the function's boolean result instead of dropping all three returns with a blank assignment. Cleaner than blank-identifier juggling and gives the caller actionable info if needed.
1 parent f8b7194 commit cff501c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

utils/winapi/console_windows.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ var (
1010
const swHide = 0
1111

1212
// HideConsoleWindow hides the console window attached to the current
13-
// process. Used when the binary is launched via Explorer double-click
14-
// so no cmd window appears.
15-
func HideConsoleWindow() {
13+
// process. Returns true if the window was previously visible.
14+
func HideConsoleWindow() bool {
1615
hwnd, _, _ := procGetConsoleWindow.Call()
1716
if hwnd == 0 {
18-
return
17+
return false
1918
}
20-
_, _, _ = procShowWindow.Call(hwnd, swHide)
19+
prev, _, _ := procShowWindow.Call(hwnd, swHide)
20+
return prev != 0
2121
}

0 commit comments

Comments
 (0)