The console under Win32?

Started by
6 comments, last by bcome 20 years, 7 months ago
How do you hide the console under the Win32 API? ==============
My Web Page!!!
<!-- ................................ -->u r what u bcomeMy (XHTML 1.0 Strict) Website
Advertisement
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.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
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!!!
<!-- ................................ -->u r what u bcomeMy (XHTML 1.0 Strict) Website
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!!!
<!-- ................................ -->u r what u bcomeMy (XHTML 1.0 Strict) Website
Try including windows.h?
An ASCII tetris clone... | AsciiRis
From MSDN: To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
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]
<!-- ................................ -->u r what u bcomeMy (XHTML 1.0 Strict) Website
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?

An ASCII tetris clone... | AsciiRis

This topic is closed to new replies.

Advertisement