如何从已编译程序中删除命令行? [英] How to remove command line from a compiled program?
问题描述
我最近开始了一个教程,学习如何使用Windows API编写GUI,并且遇到了一个意外的问题,我认为这很愚蠢。我默认使用OpenWatcom编译器的Code :: Blocks,并且创建了一个简单的GUI程序,可以很好地进行编译和链接。问题是,当我尝试启动该程序时,即使从发行版中启动,诸如命令行之类的内容也会显示在程序窗口的后面,就像我试图通过编译和运行程序一样。 Code :: Blocks的运行选项。有什么方法可以删除显示的命令行?
I have recently started a tutorial to learn how to code GUI using Windows API and I have come upon an unexpected question which I think is kind of silly. I am using Code::Blocks with OpenWatcom compiler as default and I have created a simple GUI program compiling and linking well. The problem is when I try to launch the program, even from the release version something like the command line shows up behind the window of my program, like I tried to run it through the compile & run option of the Code::Blocks. Is there any way to remove the command line from showing up?
编辑:这不是我的主要定义的问题。这是我的主要定义:|
It is not a problem with my main definition. This is my main definition: |
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
推荐答案
在Windows中,PE可执行文件格式带有标志指示可执行模式是控制台模式还是 GUI模式。如果为控制台模式,则操作系统将在运行程序时附加一个控制台窗口(必要时打开一个新窗口)。
In Windows, the PE executable format has a flag that indicates whether the executable mode is "console mode" or "GUI mode". If "console mode", then the OS will attach a console window (opening a new one if necessary) whenever the program is run.
在某处会有一个链接器设置在控制您生成的EXE被标记为控制台还是GUI的构建环境中。
There will be a linker setting somewhere in your build environment that controls whether the EXE you generate is marked as console or GUI.
这篇关于如何从已编译程序中删除命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!