直接使用GCC创建GUI应用程序,删除控制台 [英] Create a GUI application directly with GCC, remove console

查看:70
本文介绍了直接使用GCC创建GUI应用程序,删除控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定直接使用记事本+ GCC编译器(以及整个Mingw环境)创建应用程序.

I decided to create applications direct with Notepad + GCC Compiler (and the entire Mingw environment).

好,我首先创建一个简单的Win32应用程序(一个简单的窗口).该文件只有4 Kb(对于像C:B或VS这样的IDE,文件大小约为8 kb.

Well I started by creating a simple Win32 application (a simple window). The file is only 4 Kb (which, with an IDE like C:B or VS is about 8 kb.

无论如何,我的问题是不仅显示了窗口,而且还显示了窗口控制台.好吧,我不希望控制台出现,而只希望GUI窗口出现.我认为这是通过创建清单文件或类似的文件(我不太了解)来实现的,因为这是我第一次尝试这样做.如何告诉GCC它不应该创建控制台窗口-只是GUI窗口?

Anyway, my problem is that the window is displayed but also a window console. Well, I don't want the console to appear but only the GUI window. I think this is achieved by creating manifest files or something like that, of which I don't know much about, as this is the first time I am trying this. How do I tell GCC that it shouldn't create a console window - just a GUI window?

谢谢!

推荐答案

您需要创建一个针对GUI子系统而不是控制台子系统的可执行文件.在MS工具中,通常的指示方法是使用另一种形式的主要功能:

You need to create an executable that targets the GUI subsystem rather than the console subsystem. In the MS tools the normal way to indicate that is to use a different form of main function:

int WINAPI WinMain(HINSTANCE hThisInstance, 
                   HINSTANCE hPrevInstance, 
                   LPSTR lpszArgument, 
                   int nCmdShow)

我相信mingw支持相同的约定.

I believe that mingw supports the same convention.

这篇关于直接使用GCC创建GUI应用程序,删除控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆