views:

1426

answers:

13

I have a course at university where we are learning WinAPI programming. As I know C++ a bit, I must say that it is rather hard to deal with WinAPI - all these functions, structures, old-style casts, etc.

But at the same time, I think that a good book can make every difficult moment easy to learn.

My question actually consists of:

  1. What book would you advise me to read to understand WinAPI better? Except Jeffrey Richter`s 'Windows 2000 for Professional', of course:)
  2. What language you consider the most suitable and convenient for WinAPI programming? Delphi or C++?

Added: I forgot to say - MSDN not considered :)

+1  A: 

Though its for .net, this site is a decent encyclopedic reference to many of the Win32 API functions.

http://www.pinvoke.net/

StingyJack
+1  A: 

The best language for WinAPI is neither C++ nor Delphi, the best language for it is C; that is what the WinAPI itself is written in.

I have found the best way to understand the WinAPI is by read a lot of MSDN when ever I try to do something new.

SoapBox
+25  A: 

Programming Windows (Charles Petzold) is the classic text.

Rob
A: 

I personally like books that have a LOT of reference, and just the right amount of teach. If they are all teach, I read them and they sit on my bookshelf for the rest of time.

I spent years doing alot of Win32 development, and this book is really old school now, but I still have it, and it is a good resource: Win32 API SuperBible. Amazingly, this book is over 11 years old now!

Your comments about Win32 are very correct. So many people now program for .NET, and use the .NET wrapped objects. However, Win32 is still useful, and gets you much closer to the OS than most of the .NET framework.

pearcewg
+4  A: 

Other than Programming Windows by Petzold that @Rob mentioned...

If you want to learn about MFC...

MFC Programming with Visual C++ by Jeff Prosise is also a classic text.

Brian R. Bondy
+4  A: 

As previously mentioned, the Petzold is the best classic out there and is referred to by many programmers worldwide. Another book I HIGHLY recommend is Windows Via C/C++ by Jeffrey Richter & Christopher Nasarre, a great text with good referencing, it is Popular among many windows programmers as well.

John T
Yes, this is essential second reading.
Rob
A: 

I'm currently using Windows via C/C++ just like John T said. It has good examples and is pretty thorough with respect to low level Windows programming, threads, processes, handles, memory management, and DLLs.

I'd also like the echo SoapBox, with a bit more info. C or C++ are both good for Win32 API programming, just stay clear of C++ classes like string, they're a pain to deal with in the Win32 API. The API does a lot of string manipulation in parameter lists, and C++'s string class doesn't like that much.

For my current project I'm using C++, mostly because it allows things like this:

for (int i; i < 10; i++) { ... }

and C doesn't, and I like new and delete as well.

I hate new and delete since they won't let me realloc.
Vulcan Eager
A: 
  • Petzold (the bible) + Richter + Russinovich
  • MSDN
  • Advanced Win32 api newsgroup (news://comp.os.ms-windows.programmer.win32) (source code for all Win32 apis, undocumented apis...)
A: 

Although it's mostly an older DirectX book, The Zen of Direct3D Game Programming by Peter Walsh actually has a good introduction (IMHO) to Windows programming. Of course, Petzold goes much deeper.

Slapout
A: 
lkessler
good book, I started reading it immediately after getting it
chester89
A: 
  1. Win 32 Programming by Brent E Rector, Joseph M Newcomer
  2. C++ is just great. However, you may have to give up some OOPS when dealing with callbacks and other intricacies. For example, you cannot use a class member function as a callback.
Vulcan Eager
A: 

You can try Ivor Horton's Beginning Visual C++ 2008, its latest in the market and covers all latest stuff. Charles Petzold has not update his book since long and its pretty outdated considering development in VS 2008.

IMO, you are programming on vista or windows 7.

Sumit Ghosh
A: 

Even tough it's quite dated, is Jeffrey Richter's "Advanced Windows" still relevant?

telephonico