Computer Science Canada

win32 console app with no window

Author:  AnubisProgrammer [ Wed Apr 19, 2006 7:53 am ]
Post subject:  win32 console app with no window

I'm tryign to make a win32 console app that won't pop up a window. Someone told me that I could turn it into a service process or something to that effect? Any advice on writing a program with no pop-up window would be appreciated.

Author:  Andy [ Wed Apr 19, 2006 10:02 am ]
Post subject: 

if your code does not contain any outputs, then simply compile it and it shouldnt pop up the command prompt window

Author:  AnubisProgrammer [ Wed Apr 19, 2006 11:00 am ]
Post subject: 

ya, with no cout statements I still get a command prompt. I'm outputting to a text file but not to the screen, I'm not sure if that would affect it or not.

Author:  Andy [ Wed Apr 19, 2006 12:22 pm ]
Post subject: 

what does it say on the output?

Author:  AnubisProgrammer [ Wed Apr 19, 2006 5:46 pm ]
Post subject: 

well, to the screen there is no output, just a black screen. To the text file is just a letter.

Author:  Andy [ Thu Apr 20, 2006 8:54 am ]
Post subject: 

what compiler is this?

Author:  Onega [ Sun May 07, 2006 8:57 pm ]
Post subject: 

There is no way to hide to command window, but there are workarounds.
Method 1: Create an application with entry point WinMain, but you don't create a windows inside WinMain. The simplest way is to call main(...) inside winmain if you have access to source code of that console application.
Method 2: Create a windows application without a visible window, then start the console application and redirect its output to somewhere. You can refer to
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
http://www.codeproject.com/threads/consolepipe.asp

Author:  md [ Sun May 07, 2006 9:36 pm ]
Post subject: 

Umm... I'm pretty sure there is a way... and unless I _really_ don't remember anything it's as simple as a #define. 'Course I haven't done anything on windows in a long time and when I did I only got rid of the window once or twice... but I do know it can be done.


: