How do you hide the console under the Win32 API?
==============
My Web Page!!!
The console under Win32?
On NT/XP/2K use GetConsoleHandle to obtain the HWND for the console and then ShowWindow to hide it. However, that won''t prevent the console from popping up when your program launches. Another approach is to use WinMain instead of ''main'', and use freopen to redirect the stdio handles - of course, there''s not much point to stdio if there''s no console to print to or read from. Another approach is to write a WinMain wrapper program that uses CreateProcess to launch the console process without showing it. Adjust the settings of the STARTUPINFO structure appropriately to do that. A web search should turn up information regarding all of these methods. I know the question has been asked on these forums several times before.
Thanx LessBreed, I also figured out that I could do: FreeConsole(), but you do have a point in using the ShowWindow function too.
==============
My Web Page!!!
==============
My Web Page!!!
now I have a problem: I know I am including the "wincon.h" and it defines GetConsoleWindow(), but the compiler is reporting otherwise. Can anyone please tell me what I can do to fix it?
This is what I get:
error C3861: ''GetConsoleWindow'': identifier not found, even with argument-dependent lookup
==============
My Web Page!!!
This is what I get:
error C3861: ''GetConsoleWindow'': identifier not found, even with argument-dependent lookup
==============
My Web Page!!!
From MSDN: To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later.
I do include windows.h .
EDIT:
You mean to tell me that it is only available on Windows NT?!
==============
My Web Page!!!
[edited by - bcome on September 5, 2003 12:50:17 AM]
EDIT:
quote:Original post by Martee
From MSDN: To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later.
You mean to tell me that it is only available on Windows NT?!
==============
My Web Page!!!
[edited by - bcome on September 5, 2003 12:50:17 AM]
quote:Original post by bcome
You mean to tell me that it is only available on Windows NT?!
Unfortuntley it looks that way...
GetConsoleWindow().
What version of Windows are you running?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement