ShowWindow(GetConsoleWindow(), SW_HIDE); does not work with Terminal in Windows 11 #19835

Open
opened 2026-01-31 06:54:55 +00:00 by claunia · 0 comments
Owner

Originally created by @pmaillot on GitHub (May 8, 2023).

I develop small applications using C and Win32 libraries. I typically call
ShowWindow(GetConsoleWindow(), SW_HIDE); in my programs so the console/terminal window would become hidden, leaving only the GUI application and its main loop for capturing user events. Only when/if needed, would I show again the console window under certain circumstances, such as fatal errors.
This works/worked great with all instances of Windows (at least XP and W10) but in W11, as now "Terminal" takes over the console host by default, my call to ShowWindow will no longer hide the terminal.

I can ask all users to change the default "Terminal" back to Console Host, but is there another/better way?

Thx,
-Patrick

Originally created by @pmaillot on GitHub (May 8, 2023). I develop small applications using C and Win32 libraries. I typically call `ShowWindow(GetConsoleWindow(), SW_HIDE); `in my programs so the console/terminal window would become hidden, leaving only the GUI application and its main loop for capturing user events. Only when/if needed, would I show again the console window under certain circumstances, such as fatal errors. This works/worked great with all instances of Windows (at least XP and W10) but in W11, as now "Terminal" takes over the console host by default, my call to `ShowWindow` will no longer hide the terminal. I can ask all users to change the default "Terminal" back to Console Host, but is there another/better way? Thx, -Patrick
claunia added the Resolution-Duplicate label 2026-01-31 06:54:55 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19835