Author Topic: DOS Box  (Read 5993 times)

ripmav

  • Guest
DOS Box
« on: March 31, 2007, 06:44:02 pm »
Hello,
when I compile the following code with GNU GCC Comp. and execute (from the Windows Explorer) the .exe file, first a DOS Box is opened, and then the MessageBox appears.
How can I avoid the DOS Box to appear?

Code
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "test", "Hello!", MB_OK);
return 0;
}

I tried it with CodeBlocks v1.0RC2 and Windows XP

Offline Outis

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: DOS Box
« Reply #1 on: March 31, 2007, 07:08:29 pm »
Did you choose the "Win32 GUI project" or "console application" project type? You must take the first one.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DOS Box
« Reply #2 on: March 31, 2007, 07:30:16 pm »
The problem is bit different. By default Debug Target of Win32 Project is set to Console Application.

In latest nightly, you can change it via Project > Properties menu; then click on the combo showing Project settings and select Build targets. From there change the Target type to GUI application.

I would request you to upgrade you to a latest nightly. :)

Regards,

Biplab
Be a part of the solution, not a part of the problem.

ripmav

  • Guest
Re: DOS Box
« Reply #3 on: April 01, 2007, 10:44:06 am »
OK, that fixed the problem for me!!  :D

Thank you!