October 23rd, 2009, 08:19 AM
Hide a console window in VC++
I am using visual studio 6 to develop a VC++ application (Console based non MFC) to trigger an event. But when I run it, a black console window just flashes & goes off. However it successfully triggers the event. But, I want it to be hidden. I searched & found the following code to hide it but it returns errors. Here is the code
// Test_console.cpp : Defines the entry point for the console application.
#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
#define _WIN32_WINNT 0x0500
int main(int argc, char* argv)
HWND hWnd = GetConsoleWindow();
ShowWindow( hWnd, SW_HIDE );
The errors are as follows:
error C2065: 'HWND' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'hWnd'
error C2065: 'hWnd' : undeclared identifier
error C2065: 'GetConsoleWindow' : undeclared identifier
error C2065: 'ShowWindow' : undeclared identifier
error C2065: 'SW_HIDE' : undeclared identifier
Can anybody please help me.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.