views:

2890

answers:

7

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?

+6  A: 

Charles Petzold's "Programming Windows 5th Edition" is the Bible for Windows programming.

http://www.charlespetzold.com/pw5/

BobbyShaftoe
The Bible! Reading Petzold's books is a must not just to develop using directly the Win32 API (which has its pros and cons - I prefer it to using MFC, though) but also to understand how Windows works below the hood.
Joe Pineda
+6  A: 

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!

Nicholas Piasecki
+2  A: 

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!

Glenn
I've been thinking about learning MFC
Lucas McCoy
IMHO, it's definitely the way to go.
Glenn
+3  A: 

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.

anon
No, I totally agree. It's worth it for the "OH -- so THAT'S how it works" and for the "OH -- so THAT'S why there have been a bajillion wrappers for it" and for the "OH -- so THAT'S why we don't do it that way anymore." =)
Nicholas Piasecki
+6  A: 

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.

Alien01
+1  A: 

There is also wxWidgets which has different licenses compared to QT.

This is exactly what was being talked about on The SO Podcast, users who can't comment post answers. I'm not mad at James Tan, just the way the SO system prevents spam.
Lucas McCoy
+1  A: 

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.

Diones