简体   繁体   中英

how to add in Visual Studio 2010 WinForm Object to a C++ Console Application Project

I am building a C++ Console Application which makes some OpenGL printing.
The entire thing is done by glut and gl libraries. My new goal is to add some Windows Forms to the project so one could "configure" the 'game' with some textbox and other controls provided by VS before the console appliction starts.
I know that the best solution for the current problem is to add Win32 API, but I don't know how to integrate console application project with win32 API alltogether.
I know that in C# it's done quite easily with the .ShowDialog() command.

Although launching a window from a console application is perfectly doable, that window will not be responsive, because your console application does not have a message queue. (Or rather, it has a message queue, but it is implemented by code that you have no control over.) So, you can open up a window, draw in it, and force it to manually update, but you cannot receive user input in it.

I would suggest that you forget about doing it this way, and you write a little windowed application instead, which prompts for the configuration and then launches the console application passing it the configuration as command-line parameters, or fills-in a configuration file for the console application to read.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM