Naveen
Naveen

Reputation: 105

How can I avoid the Console while doing GUI with C?

Okay this is the sample code

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "A threat has been detected by Windows!!", "Warning!!", MB_OK);
    return 0;
}

But whenever I compile this. It gives me a Message Box as ecpected but what I get more is the Command Prompt with it. I just don't want that ugly thing how can I modify or compile my code to get only the GUI ? I am using Code::Blocks IDE.

Upvotes: 0

Views: 59

Answers (1)

Leandro Carracedo
Leandro Carracedo

Reputation: 7375

This is related to Code Blocks IDE, you have to change the type application in your project.

From the project properties, tab Build Targets, change the type console application to GUI application.

Check: http://forums.codeblocks.org/index.php?topic=12007.0

Upvotes: 1

Related Questions