views:

115

answers:

2

I'm writing a console program.

The program doesn't print anything.

So, it doesn't need to a console window.

I tried to call FreeConsole() function at program starting point.

When I execute the program from windows explorer, a console window appears and then disappears.

But I wish the console window never appears.

How can I do that?

Thanks in advance.

+2  A: 

Use WinMain instead of main as your program's entry point: WinMain at MSDN

MeDiCS
You actually need to switch the project type to console as well - Whether or not a console is required is determined by a bit in the executable header, not the name of the entry point.
Michael
True. You'll probably get a link error if the subsystem isn't set to 'windows' (I think that's how it's called) instead of 'console', but I'm using VC as a guide here.
MeDiCS
I thought a window application project as like you said. But it was a plan B.Console project never can this? I just want to know well. If it is impossible, I'll change my project type. Thank you!
Benjamin
+3  A: 

If you are using Visual Studio .Net then create a normal console application and change the output type to Windows application.

JD