将控制台应用程序转换为 Windows 应用程序

2022-01-05 00:00:00 visual-studio-2008 windows-xp c++

(这是一个很长的故事)但我有一个包含 Windows 程序的大型复杂项目文件.不幸的是,该项目最初是作为控制台应用程序构建的.程序编译和链接正常,但是当运行时会弹出一个控制台而不是我希望的窗口集合.我查看了命令行并看到了/SUBSYSTEM:CONSOLE",而它应该是/SUBSYSTEM:WINDOWS".我不知道如何更改命令行.我可以在项目设置中的某处打勾以进行此更改吗?

(its a long story) but I have a large complex project file containing a windows program. Unfortunately the project was originally built as a console app. The program compiles and links ok but when runs brings up a console instead of the collection of windows I was hoping for. I looked at the command line and saw "/SUBSYSTEM:CONSOLE" whereas it should be "/SUBSYSTEM:WINDOWS". I have no idea how to change the command line. Is there some box I can tick in the project setting somewhere to make this change?

推荐答案

右键单击解决方案资源管理器中的项目图标,然后属性>链接器>系统>子系统,并将其设置为窗户.您还必须将 main() 方法更改为 WinMain().而且你最好创建一些窗口,否则就没什么可看的了.

Right-click the project icon in the Solution Explorer, then Properties > Linker > System > SubSystem, and set that to Windows. You'll also have to change your main() method to WinMain(). And you'd better create some windows or there won't be much to look at.

相关文章