Beginning Windows Programming

Started by
10 comments, last by Fenrisulvur 14 years, 5 months ago
I'm new to GUI and windows programming, but not new to programming. Can someone recommend an up to date book or two for a beginner to learn some windows GUI programming from the ground up? I am interested in WIN32 and .Net. I'll be using C++. Is there any value in learning WIN32 or is .Net the way to go with Managed C++? Thanks for your help!
Advertisement
For native MS C++/Win32, go for Petzold.

Hope this helps!
-Zyro
Hmm... everyone speaks so highly of this book, but it's 11 years old. Will it really be useful for a beginner? Any ideas on C++.net?
Quote:Original post by Runicode
Hmm... everyone speaks so highly of this book, but it's 11 years old. Will it really be useful for a beginner? Any ideas on C++.net?


Win32 pretty much hasn't changed in 11 years. So yeah if you want the bible on Win32 programming that is the book to get. As long as you have a grasp of C (book uses all C style and not C++) then even a beginner can learn a lot from it. But anymore .NET is the way to go if you want to do basic Windows programming. While you can do .NET with C++/CLI, using C# is probably the easier choice to get things going at a decent pace.
Seconded. Petzold is the way to go.

It's huge, but a great jumping off point into Win32.
Quote:
Hmm... everyone speaks so highly of this book, but it's 11 years old. Will it really be useful for a beginner? Any ideas on C++.net?

You mean "C++/CLI," and you want to stay as far away from that as possible. It's not a beginner-friendly language and its main utility is for building interoperability layers between managed and native code -- as stupid_programmer says, you want to use C# if you're going to write managed code.
Quote:Original post by Runicode
Can someone recommend an up to date book or two for a beginner to learn some windows GUI programming from the ground up? I am interested in WIN32 and .Net. I'll be using C++. Is there any value in learning WIN32 or is .Net the way to go with Managed C++?

The .NET variant of C++, C++/CLI, is not C++. For more information, read what C++'s creator, Bjarne Stroustrup, has to say on the matter.
Another vote for C#.NET from me if you're planning on doing .NET development, btw, even if Stroustrup disagrees. >_>

As for Win32? theForger should get you started. Like Petzold, though, the language of choice is C.
So a mastery of C would be required to step through the book and recommended resource? Does anyone know of any resources that focus specifically on C++ & WIN32? I have experience with C++, but not C (I know they're similar) and I'm not sure if that will impact how quick I can learn the material.
I haven't read it, but I really doubt you don't need a 'mastery' of C to learn the Win32 API from the Petzold book. It will probably just use some aspects of the C Standard Library you probably aren't too familiar with and he probably declares all variables at the start of a function block.

What you should try to do is replace the C-style for more C++-style code. Using const variables in place of macros. std::string for strings when possible. If a Win32 function asks for a buffer try to use std::vector for the buffer. If that buffer is for a null terminated string you can then convert the std::vector buffer to a std::string using the C++ Standard Library.

There are also some tutorials on the internet that describe how to create Window classes that may also be of assistance. Oluseyi wrote an article somewhere on gamedev.net that describe how to do this, for instance.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

What about MFC, if I read up on MFC would that cover any WIN32 or is MFC on its way out the door? Isn't MFC entirely C++? I guess if I do go with Petzold, I would need approach each section and attempt to understand it from a C++ perspective as you mentioned.

This topic is closed to new replies.

Advertisement