在使用C进行GUI时如何避免使用控制台?

时间:2015-01-23 14:49:13

标签: c user-interface codeblocks

好的,这是示例代码

#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;
}

但每当我编译它。它给了我一个受欢迎的消息框,但我得到的更多是它的命令提示符。我只是不想要那个丑陋的东西,我怎么能修改或编译我的代码才能获得GUI?我正在使用Code :: Blocks IDE。

1 个答案:

答案 0 :(得分:1)

这与代码块IDE有关,您必须更改项目中的类型应用程序。

从项目属性选项卡Build Targets中,将类型控制台应用程序更改为GUI应用程序。

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

相关问题