Archived

This topic is now archived and is closed to further replies.

bcome

The console under Win32?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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!!!

Share this post


Link to post
Share on other sites
I do include windows.h .

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]

Share this post


Link to post
Share on other sites