Author Topic: WINAPI program has DOS window  (Read 4451 times)

serverul

  • Guest
WINAPI program has DOS window
« 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

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: WINAPI program has DOS window
« Reply #1 on: June 29, 2008, 10:09:33 am »
Hi !

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

Dje

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: WINAPI program has DOS window
« Reply #2 on: June 29, 2008, 10:15:52 am »
The debug-version uses afaik a dos-window.

serverul

  • Guest
Re: WINAPI program has DOS window
« Reply #3 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 ;)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: WINAPI program has DOS window
« Reply #4 on: June 29, 2008, 01:57:45 pm »
...
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

  • Guest
Re: WINAPI program has DOS window
« Reply #5 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