From 55657e72aeaac037f78859c576d00878c50fe0b8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 25 May 2022 00:13:26 +0900 Subject: [PATCH] internal/ui: skip hideConsoleWindowOnWindows in Xbox Updates #2084 --- internal/ui/hideconsole_windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/ui/hideconsole_windows.go b/internal/ui/hideconsole_windows.go index bdcaa71d3..1179cc5fa 100644 --- a/internal/ui/hideconsole_windows.go +++ b/internal/ui/hideconsole_windows.go @@ -49,6 +49,11 @@ func getConsoleWindow() windows.HWND { // hideConsoleWindowOnWindows will hide the console window that is showing when // compiling on Windows without specifying the '-ldflags "-Hwindowsgui"' flag. func hideConsoleWindowOnWindows() { + // In Xbox, GetWindowThreadProcessId might not exist. + if user32.NewProc("GetWindowThreadProcessId").Find() != nil { + return + } + pid := windows.GetCurrentProcessId() // Get the process ID of the console's creator.