I am trying (and perhaps I shouldn't) to use this technique to allow a console application to open a window to draw stuff, wait for it to close, then do some more computing and open another window. This second instantiation of MFC dies a quick, horrible death, and I was hoping someone knew how to fix that.
This example is doing a useful thing however I should
say it is not very desirable, since it requires re-compilation between pure GUI and console mode of the same application. Suppose I have a dialog based GUI application, I want to turn it it to a hybrid console application. What I mean by hybrid is: when user starts it from a command line, no GUI or GUI related stuff will be generated (this is my part and I can guarantee that) but I want to see cout, printf etc regular console outputs to be enabled..
So the whole application should be seamless, between GUI and console mode. The example here always first creates a parent console, it is disturbing view when you only want GUI, and you don't want to re-compile.
This program is very useful for me,
But I have a problem :
I added _CONSOLEWIN to my project's settings like you told.
But when I launch my prog, it works good, the cout messages appear in the console. But when I leave my prog by a PostQuitMessage(0), the console stays on.