Book recommendations for a beginning Windows programmer

Hello. It's been a few years since I started programming, (1 year with C++ and 2 years with Java). I think I've mastered the basics, I've already wrote a few software for some customers with Qt and Boost and I'm ready to take things to the next level, developing commercial level UI software with C++ and the Win32 API. I've searched on the internet for books that teaches the basics of Windows Programming but unfortunately couldn't find much help.
So it would be very helpful if you, the one reading this post, could give me recommendations for C++ programming with the Win32 API (specifically with Graphical User Interface). Sorry if I was not clear enough.
Suggestions:
*google "winapi tutorial" this is how I've learned it. Most top google winapi tutorials will teach you how to write windows UI programs. However, know that Windows API is much bigger than that.

*google "winapi contorls"

*if any of the tutorials don't cover anything specific. Google it ! For instance: "winapi how to disable button" or "winapi how to change text color"

*I hope you want to learn native winapi ui just for knowledge. Native winapi is not the way to write UI program (it was in the past). Now we have things like .NET and CLR. Learn C# and windows forms or WPF. If you don't want to learn a new language you can program in .NET in C++. The main reason for using .NET (managed code) is UI designer available in visual studio which speeds u UI design by factor of 100.
Here is a series of tutorials you might find useful:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff381399%28v=vs.85%29.aspx

Do yourself a favor and bookmark that site as it contains the most comprehensive winapi reference.

If you really want a book the only one I know of is Programming Windows 5th edition.
Why doesn't someone who runs this forum make a sticky on this? This very question comes up at least once a week for years and years and some of us who have been around for a long time have answered it hundreds of times. A serach on "Learn Win32 Api" will give one some idea of how many times its been answered here.
Sorry to add to the long list of similar questions but I would very much like a recommendation for a book - I am fairly confident in C++ using the console but would now like to jump to building a windows program but carrying on just using code::Blocks and not SDK or Visual Studio.

Is this possible please?

Thanks
In all the versions of Code::Blocks I have tried there is a template for building an SDK style GUI app. Charles Petzold's "Programming Windows" 4th or 5th edition explains this style. You can use either the GCC or MSVC compiler to build Windows programs almost equally as well.

Since I only do SDK style I wouldn't know about other alternatives or documentation teaching those alternatives.
[Johnson_M._Hart]_Windows_System_Programming

Very great book on windows system programming, but if you really would like to learn system's programming, I had suggest that you learn linux systems program since it allows you to play with kernel codes and gives more freedom to do all sorts of crazy stuffs

LINUX SYSTEM PROGRAMMING BY ROBERT LOVE PUBLISHED BY ORIELY
Last edited on
I have ordered Charles Petzold 5th edition as recommended above and am intending to use Code::Blocks GUI project style, frame based.

My only worry is that I have had a look at the free PDF of the book whilst awaiting delivery and notice that the examples are in C and not C++; is this a problem that is going to take me backwards after learning (trying anyway) C++.

Are there things I should look out for and change eg using cout instead of printf.

Any other general pitfalls or advice would be very much appreciated.
After you read that book I would at least glance over the tutorials I linked as some practices may be out of date. Particularly the use of TCHAR's, which seem to be useless now. See this relevant article:

https://msdn.microsoft.com/en-us/library/ff381407%28VS.85%29.aspx

New applications should always call the Unicode versions. Many world languages require Unicode. If you use ANSI strings, it will be impossible to localize your application. The ANSI versions are also less efficient, because the operating system must convert the ANSI strings to Unicode at run time. Depending on your preference, you can call the Unicode functions explicitly, such as SetWindowTextW, or use the macros. The example code on MSDN typically calls the macros, but the two forms are exactly equivalent. Most newer APIs in Windows have just a Unicode version, with no corresponding ANSI version.
These are the kinds of questions I love.

You may gain some info on this issue from reading this ...


http://www.jose.it-berater.org/smfforum/index.php?topic=3389.0

The above is something of a tutorial I wrote on SDK style Windows Programming using C and C++.

cout and iostream will be of less use to you in Graphical User Interface (GUI) coding than in console mode programming - largely because of the meaning of the 'c' character of 'cout', i.e., an abbreviation for 'console'. I really doubt that your main interest in learning GUI coding is to continue using the console. You have to realize that in moving on to GUI coding you are moving into a brave new world where some old friends such as the console might be left behind. Having said that, sometimes the console is useful for debugging and other purposes in GUI programs, and in those cases is just an AllocConsole() Api call away.

I consider myself a C++ coder and I use classes and templates a lot. However, the underlying GUI framework of my apps is pretty close to standard SDK C style. After all, C is a subset of C++. So I wouldn't consider the problem exactly as 'going backwards'.

You will run into issues however. It has been my experience in looking over a number of C++ books and in interacting with new C++ coders who haven't come to the language byway of C, that a lot of new C++ coders atre weak with the concept of function pointers. These are used heavily in the raw Win32/64 Api, and if you don't have a good understanding of them it may seem quite mysterious. The reason for this I expect is that the class mechanism of C++ is such that it absracts away the need for function pointers which were used heavily in C in various contexts.

Another issue I have seen with C++ coders in their first contact with the Windows Api is their failure to recognize that the Windows Api is a very good example of Object Oriented Programming, albiet done in C. What many or most seem wont to do is wrap it up in C++ Class machinery so it looks more familiar to them, and what that ends up doing is creating another layer of encapsulation/abstraction that adds zero to the functionality of what they are doing; it creates bugs; and it doubles or triples the executable program size. What you need to keep in mind is that OOP is a methodology - not a programming language. C++ is but one specific implementation of the general concept.
Topic archived. No new replies allowed.