windows application run on several windows subsystems: console, windows, posix, whatever
http://msdn.microsoft.com/library/de...mplref_135.asp
http://msdn.microsoft.com/library/de...locconsole.asp
to run a application with main you have to specify subsystem console (it's the default to most compilers). To work with a gui, specify windows. With a gui, you can call AllocConsole() to create a console for your process.
http://msdn.microsoft.com/library/de...locconsole.asp
with a console app... itīs a bit harder to get rid of the console. I donīt know why
where's a small example - of course this syntax for pragma coment is Ms specific. I don't know the gcc version. Never tried it
A console app
Code:
#pragma comment(linker, "/SUBSYSTEM:CONSOLE")
#include <iostream>
int main(){
std::cout<<"Hllo world!"<<std::endl;
return 0;
}
a gui app
Code:
#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
#include <windows.h>
int WinMain(HINSTANCE hc, HINSTANCE hp, LPSTR cmdln, int guicmd){
MessageBox(GetDesktopHandle(),"hello world","hello world",0);
return 0;
}
any process can run without any console or window.
Of course to kill it you have to go to Task Manager