在 GLUT 应用程序中隐藏控制台窗口的便携式方法?
嘿,我正在创建一个小 GLUT 应用程序,需要隐藏/删除控制台窗口的帮助。
我正在 Windows 上进行开发,并且我已经知道在 Windows 系统上隐藏控制台窗口的各种方法,但是没有可移植的方法来隐藏它吗?
谢谢...
Hey, I'm creating a little GLUT application and need help with hiding/removing the console window.
I am developing on windows and I already know of the various methods to hide the console window on a windows system, however is there no portable method of hiding it?
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您真的不想“隐藏”控制台窗口。您想要的是将编译器配置为生成“Windows 应用程序”而不是“控制台应用程序”。这将告诉 Windows 永远不要为您的应用程序创建控制台。您需要查阅编译器的文档来了解如何执行此操作。对于 Visual Studio,这是其中一个向导中的一个步骤。
没有真正的好方法来控制控制台应用程序内部的控制台。控制台的设计使得应用程序对此一无所知。正如您所说,虽然这是可能的,但它不是很便携或干净。
如果您需要对“控制台”进行细粒度控制,正确的方法是实现您自己的窗口,该窗口提供一个文本输出区域,您可以在其中打印内容。然后,您可以使用“控制台”执行几乎任何操作,因为它并不是真正的控制台,它只是您的应用程序拥有和操作的另一个窗口。
You don't really want to "hide" the console window. What you want is to configure your compiler to generate a "Windows application" instead of a "Console application". That will tell windows to never create a console for your application. You'll need to consult your compiler's documentation to figure out how to do that. For Visual Studio, it is a step on one of the wizards.
There isn't really a good way to control the console inside of a console application. The console is designed so that the application knows nothing about it. While it is possible, as you said, it's not very portable or clean.
The correct approach if you need fine-grained control over the "console" is to implement your own window which provides a text output area where you can print things. Then you can do pretty much anything with your "console" because it isn't really a console, it's just another window owned and operated by your application.