I want to learn C++ GUI programming using Visual Studio 2008. I'm not sure where to start though. I learned C++ in high school, but not GUI. I've been doing C# for about 3 years now and thats how I "learned" GUI programming. Now I want to learn how to write GUI's without the use of the .NET framework, so where do I start?
Charles Petzold's "Programming Windows 5th Edition" is the Bible for Windows programming.
Since you say you've been doing C# GUI programming for about 3 years, I'll assume that means Windows Forms. One way to dip your toe in the water is to remember that WinForms is really just an object-oriented wrapper around user32
. So load up Reflector and take a look at the way some of the controls are implemented. You'll see that these strange messages like WM_PAINT
and WM_KEYDOWN
are pumped to the WndProc
of the various controls by Windows. In plain old Win32 or MFC programming, the same thing is still going on. Doing this will let you slowly peel back the layers of the onion; you'll get a better feel for how Windows Forms works, too. From there, I'd recommend picking up Programming Windows by Petzold; it's old, but the native APIs in Windows don't move around that much. Have fun!
Would it be OK with you to write GUIs in VC++ using Microsoft Foundation Classes or MFC? That is how I would and have written VC++ GUIs in the past.
There have been many books written on MFC over the years. I'm sure any one of them will do nicely. You may find in the literature the reference ATL which is a Microsoft iteration on STL. MFC and ATL kind of merged over the years so anything ATL is also applicable to an MFC app these days.
Good luck and have fun!
Some heretical opinions...
I wouldn't recommend C++ for writing complex Windows GUIs - language/library combos like C# or Delphi are so much more productive. If you want to get into C++ programming I'd suggest using it to write a multi-threaded server of some sort - a simple Web server would do for starters.
And if you really want to understand the underlying Windows APIs, I think there is something to be said for writing a simple application (like, say, a simplified version of notebook) in C (not C++). You'll only want to do it once, but you will learn a lot in the process.
And before anyone starts madly down-voting, let me say that I am a C++ programmer of over 20 years standing, and really love the language.
MFC is almost outdated now. I would recommend to use WTL instead .
Well it is also not a good idea just to start programming for GUI in C++ when there are so many good frameworks available like QT cross platform framework.
Ah I know how you feel, old interpreted languages programmer that want to know the magic behind compiled programing. Well I can't find the tutorial that I used to learn windows programing, but just know that there is good win32 tutorials around, so you don't waste your time buying a book just yet. I found it: http://www.relisoft.com/win32/index.htm Neatest tutorial around, trust me.