Monday, April 27, 2009

A little programming trick

Have you ever wanted to have a C++ program that uses an MFC GUI and a console? Here's a link to how to do it.
For those who don't program in C++, you probably don't care, but here's an explanation, anyway: in the old days, before Windows, C++ programs used to have "print" statements to print to the screen you saw in DOS (They're called "printf" or "cout".) They're a convenient way to show what's going on in your program behind the scenes, or just to show a lot of information as the program is running. I still use it for most of my programs, becuase it's simpler than using all the Windows overhead.
Once you start programming for Windows, you get dialog boxes and menus and all that Graphical User Interface stuff, but you lose the ability to just print stuff out when you need to. This little hack lets you have the best of both worlds.

No comments: