News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

WINAPI program has DOS window

Started by serverul, June 29, 2008, 09:41:05 AM

Previous topic - Next topic

serverul

hi,
I wrote a very simple program in c using windows.h and when I compile it and run it I get a DOS window and them my windows message box

#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
        MessageBox(NULL, "Good Morning", "BOO!!!", MB_OK);
    return 0;
}


this is the code though I think it's irelevant, and I tryed compiling the code in Visual c++ and I don't get the DOS window there.

Can anyone pls tell me how to get rid of that?

ty

dje

Hi !

Did you chose the right project template (Win32 GUI project) to build your exe?

Dje

Jenna

The debug-version uses afaik a dos-window.

serverul

Quote from: jens on June 29, 2008, 10:15:52 AM
The debug-version uses afaik a dos-window.

ty ;) I modified my project to be for relese only and I got rid of that DOS window ;)

Biplab

Quote from: serverul on June 29, 2008, 09:41:05 AM
...
Can anyone pls tell me how to get rid of that?

Add -mwindows to linker options.
Be a part of the solution, not a part of the problem.

wokuku

Two Ways:
1. you can change the "built target"  into "release"

2.  In the project->properties->build targets ,  the "Type" choose "GUI application"


They are mostly the same