tags:

views:

20

answers:

1

Hello,

I have a question regarding Visual C++. While executing a Visual c++ project file, the application runs and along with that, a command window gets opened. It normally disappears as soon as the application running is done. I am not sure if that command window could be avoided when the application runs.

Thanks, Krishna

A: 

Win32 executables must be either a command line application or a GUI application.

If your EXE is a command line application and it is executed from a command line then no extra window is created.

If your EXE is a command line application and it is executed from a GUI application then a new console window will be created for it.

If your EXE is a GUI application then it's up to you to create whatever window(s) you want.

Check how your application is being compiled and then make the right decision for your app. In Visual Studio follow these steps:

  1. In Solution Explorer right-click on the VC++ project node and choose Properties
  2. Navigate to: Configuration Properties / Linker / System
  3. Check the value of the "SubSystem" property

Two of the SubSystem options are Windows and Console, and these describe the two settings I mention earlier.

More information about this GUI vs. Command Line behavior is available on these links:

  1. How do I write a program that can be run either as a console or a GUI application?
  2. Program both as Console and GUI
Eilon
That's too quick. Thanks a lot! I would go through the links provided and would append here for further questions.
krishna
I added some clarification to my answer about where to find the settings in Visual Studio.
Eilon