Possible Duplicate:
Create an Application without a Window
Win32 programming hiding console window
How can I hide the console window that appears when I run my C++ program? The program doesn't output anything to stdout, and I don't need that black window to appear each time I run the program. I don't want it to be minimized I want it to be invisible. Any ideas?
If you want to hide the console you can call FreeConsole on windows
#include <Windows.h>
int main()
{
FreeConsole();
//other stuff
}
As David mentioned this might flash for a brief second. If you don't want that you can create a windows service or a windows gui application and not create a window like below
#include <windows.h>
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
//do stuff here
return 0;
}
It sounds like the problem is that you are creating a console application. These come with a console by default. They either inherit the console of the process that called them, if it has one, or otherwise create a new console.
You should make your application target the GUI subsystem rather than the console subsystem. This doesn't mean that you have to show any GUI. It's perfectly reasonable and commonplace to make an application that targets the GUI subsytem but does not show any windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With