Create a Window in a Visual Studio 2012 console ap

2019-07-18 21:55发布

问题:

Is there a way to create a Window in a C++ Console Application? I have already a console application for creating some data and I want to show them in some graphics, but not inside the console. Is this possible?

回答1:

You use a function called CreateWindowEx(), See here.

It's rather complex, you need to create a WNDCLASSEX structure and use RegisterClassEx() on it before passing it as a parameter to CreateWindowEx(). You also need to create Message Procedure function.

This article on MSDN runs through it quite nicely