CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2011
    Posts
    11

    Best C++ WinAPI Book Since Petzold?

    I've been using C# for a while, but last week I found that even my very clumsy first attempts at using C++ and the native WinAPI made a huge difference in speed (you can read all about it in yesterday's post in the C# forum, "Help: My C# Program is 250x Slower Than My C++ Program!"), so I want to switch to that. I have some books on C++, but they all use .NET or MFC when they talk about Windows programming.

    I have Petzold's last (I think) book on programming for the native WinAPI, but it was written for Windows 98. It seems like all the books on learning C/C++ programming for Windows since then have used MFC or .NET.

    Are there any recent books that teach pure WinAPI programming for Windows 7, using VC++ 2008 or 2010? Or would I do better with some other IDE?

    If there are no good books, can anyone point me to the best articles/tutorials they've found on the web? When you get ten million hits on Google, it's hard to know where to start.

    Thank you.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Best C++ WinAPI Book Since Petzold?

    I have Petzold's last (I think) book on programming for the native WinAPI, but it was written for Windows 98. It seems like all the books on learning C/C++ programming for Windows since then have used MFC or .NET.
    Pure WinAPI programming did not change noticeably since Win 98/2000, so Petzold's book basically still remains actual for this particular aspect. Of course, there are some changes in GUI controls introduced by Vista/7, but those always could be learned directly on-line.

    Are there any recent books that teach pure WinAPI programming for Windows 7, using VC++ 2008 or 2010? Or would I do better with some other IDE?
    Pure WinAPI programming is totally independent from any IDE. ATL/MFC projects appear really helped by IDE support, but WinAPI programming is still old fashioned manual typing in.
    Best regards,
    Igor

  3. #3
    Join Date
    Oct 2011
    Posts
    11

    Re: Best C++ WinAPI Book Since Petzold?

    Thanks for your response. I realize that the basic techniques in Petzold are still valid. However, there have been at least four new editions of Windows, and hundreds of new functions added to the Windows API, since it was written. Yes, they are documented on MSDN, but it is not easy to sort out which ones are the best for a given situation just by looking at the docs.

    Petzold himself wrote a book on C#.NET Forms programming in 2002 or so, then just three years later, he wrote another one that didn't invalidate anything in the first one, but showed how to do things in a much easier way with the newer and more powerful functions that came out in 2005.

    I was hoping there would be a more recent book that did the same thing for the native API. I did find "Windows via C/C++" by Richter, written in 2007, but it seems to be targeted at people who are already comfortable with the API and are just looking to get the last 10% out of their code.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Best C++ WinAPI Book Since Petzold?

    and hundreds of new functions added to the Windows API, since it was written.
    You have to distinguish GUI programming (what Petzold's book is completely about) and programming client side apps making use of kernel services (what Richter's book is completely about). All the hundreds of new functions you mentioned represent evolution of kernel services most of all, but not GUI.

    I did find "Windows via C/C++" by Richter, written in 2007, but it seems to be targeted at people who are already comfortable with the API and are just looking to get the last 10% out of their code.
    This is where you're wrong. The book is focused on kernel services which make an API subset completely different from GUI oriented API. And I assure you, the book definitely is for beginners.

    And I would warn you about estimating it as "the last 10%", as the estimate better fits with Petzold's book. I just cannot imagine a book that would cover every single part and pit of numerous Windows APIs.
    Last edited by Igor Vartanov; October 18th, 2011 at 12:26 AM.
    Best regards,
    Igor

  5. #5
    Join Date
    Aug 2003
    Location
    Louisiana
    Posts
    72

    Re: Best C++ WinAPI Book Since Petzold?

    I am not sure if this is exactly what you are looking for, but you might want to take a look at...

    http://www.amazon.com/Windows-Progra...8946404&sr=8-1

  6. #6
    Join Date
    Oct 2011
    Posts
    11

    Re: Best C++ WinAPI Book Since Petzold?

    Quote Originally Posted by Skeeterbreath View Post
    I am not sure if this is exactly what you are looking for, but you might want to take a look at...

    http://www.amazon.com/Windows-Progra...8946404&sr=8-1
    Thanks, that looks very interesting.

  7. #7
    Join Date
    Oct 2011
    Posts
    11

    Re: Best C++ WinAPI Book Since Petzold?

    Quote Originally Posted by Igor Vartanov View Post
    And I assure you, [Richter] definitely is for beginners.
    Thanks for the info. I haven't read it, but I assumed it was advanced, because the older editions of his books were called "Advanced Windows Programming" or something like that.

    Can it really be true that there have been no important (to a beginner) updates to the GUI part of the WinAPI in the last 14 years?

    On the other hand, if you can bear to slog through my very long posts in the C# forum ("Help: My C# Program runs 250x Slower than My C++ Program," you will see that I was able to use P/Invoke to make my C# program almost as fast as the WinAPI program, so now I'm thinking I'll stay with C# after all. But it can't hurt to know more about the API, so I hope there are more suggestions.

  8. #8
    Join Date
    Oct 2005
    Location
    Minnesota, U.S.A.
    Posts
    680

    Re: Best C++ WinAPI Book Since Petzold?

    Quote Originally Posted by brocks View Post
    Can it really be true that there have been no important (to a beginner) updates to the GUI part of the WinAPI in the last 14 years?
    Yes. Remember that is something that MS is VERY good at - backwards compatibility. A properly written MS-DOS program (not using hardware shortcuts) from 80s will still run on Windows 7.

    Quote Originally Posted by brocks View Post
    On the other hand, if you can bear to slog through my very long posts in the C# forum ("Help: My C# Program runs 250x Slower than My C++ Program," you will see that I was able to use P/Invoke to make my C# program almost as fast as the WinAPI program, so now I'm thinking I'll stay with C# after all. But it can't hurt to know more about the API, so I hope there are more suggestions.
    Remember that the underlying Windows API code is written in C/C++/Assembly and is MUCH faster than using built APIs in other languages, which all boil down to calling the Windows API anyway, but with a lot of intermediary junk between. You can make your C# program faster by calling Window API rather than the packaged classes. They are often more difficult to call, which is why a lot of the stuff is built on top of them to simplify programming for beginners.

    -Erik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured