Code::Blocks Forums

User forums => Help => Topic started by: serverul on June 29, 2008, 09:41:05 am

Title: WINAPI program has DOS window
Post by: serverul on June 29, 2008, 09:41:05 am
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

Code
#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
Title: Re: WINAPI program has DOS window
Post by: dje on June 29, 2008, 10:09:33 am
Hi !

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

Dje
Title: Re: WINAPI program has DOS window
Post by: Jenna on June 29, 2008, 10:15:52 am
The debug-version uses afaik a dos-window.
Title: Re: WINAPI program has DOS window
Post by: serverul on June 29, 2008, 10:20:51 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 ;)
Title: Re: WINAPI program has DOS window
Post by: Biplab on June 29, 2008, 01:57:45 pm
...
Can anyone pls tell me how to get rid of that?

Add -mwindows to linker options.
Title: Re: WINAPI program has DOS window
Post by: wokuku on July 28, 2008, 01:18:05 pm
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