Link to home
Start Free TrialLog in
Avatar of xassets
xassets

asked on

Converting a C++ console application to become windowless

This must be easy.

I have a C++ console application with the usual void main (int argc, etc etc.

Now when I run it, it creates a DOS window. How do I stop it doing that ? I just want it to run windowless. There is no user interation.

Even when the program does no outputs (printf etc), it still produces a black window !

Its compiled with msvc 6

Avatar of Dexstar
Dexstar

@xassets:

> How do I stop it doing that ? I just want it to run windowless. There is no
> user interation.

Go into your linker settings, and where it has the big edit box that says "Project Settings", find where it says:
     /subsystem:console

And change it to:
     /subsystem:windows

Let me know if you have any other issues after making that change.  Be sure to do it for both the debug and release builds of the project.

Hope That Helps,
Dex*
And add also:
/ENTRY:mainCRTStartup
to the linker options.
Avatar of xassets

ASKER

I also have preprocessor definitions :

WIN32,NDEBUG,_CONSOLE,_MBCS

And project options

/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Release/" /Fp"Release/myprog.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c

Should I take _CONSOLE out of preprocessor ? And should I remove the /D "_CONSOLE" . Do I need to add "_WINDOWS" or something in there ?

Didn't want to take any risks on destabilising this product so better to ask first ! Thanks guys
ASKER CERTIFIED SOLUTION
Avatar of Dexstar
Dexstar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xassets

ASKER

Works like a dream

Thanks