12

Has the Windows 32 API changed much over time? Does the Charles Petzold book "Programming Windows, 5th Edition" from 1998 still contain relevant information, or is most of it obsolete/outdated?

What are some prominent examples of recent additions to the Windows 32 API (if there are any)?

4 Answers 4

4

The new Thread Pool API in Windows Vista is a serious improvement and aid to well-written multiple thread programs, for a simple example of how WinAPI has evolved. However, the need to maintain compatibility has been a driving factor to keeping the basics of the Windows API the same and has resulted in some non-ideal things, like the predominance of Ex functions like CreateWindowEx. There are still functions compilable against 64bit Windows that are for compatibility with 16bit programs.

That book is still going to be of use if you want to write WinAPI-based programs that perform functions that were common in 1998, as it's unlikely that the API has changed. Of course, the best practices in the originating language may well be leagues ahead, especially if the book is written for C or C++, since a book from 1998 almost certainly was written against pre-Standard C++.

Also, the correct reference is Windows API, not Windows 32 API, as the same API governs both Windows 32 and Windows 64.

4

I've found Programming Windows to still be useful. Thanks to Microsoft's emphasis on backwards compatibility, all of the core stuff (window handles, messages, GDI, etc.) seems to still be relevant and is covered well in Petzold. (If anything changed too drastically, it would break too many existing Windows programs, and the huge number of existing Windows programs is a big part of Windows' advantage in the marketplace.)

There are specific new APIs, like Setup API, the Thread Pool API, and GDI+, and there are new topics such as working within the context of Vista's and 7's UAC. There are also several individual new functions, that Petzold doesn't cover, but it's easy enough to look up newer topics on MSDN as needed. Programming Windows also doesn't cover COM, which can be a big part of Windows programming.

Keep in mind that the API that Petzold covers is all low-level and C-based. (There are a few newer APIs, like GDI+ and some of the COM stuff, that are object-oriented.) Virtually any modern development will be object-oriented and will often use a framework like .NET or Qt or Delphi's VCL, so you'll rarely write complete applications that look like the example code in Programming Windows; however, it's still great for explaining what's going on under the hood.

I looked around a while ago and couldn't find any newer API references. I suspect this is because of the sheer size of the current Windows APIs; Programming Windows, 5th Edition is already almost 1500 pages long, a book that covered anything new would be too huge. I did find a couple of interesting-looking supplements to Programming Windows, although I haven't read them yet:

  • Essential COM, by Don Box - Several of Vista's new APIs are COM-based, and Petzold doesn't cover COM.
  • Windows System Programming, by Johnson M. Hart - seems to entirely skip the GUI and GDI stuff that Petzold covers so well, but it has much more detail on modern approaches top multithreading, IPC, etc.
  • Windows Internals, by Russonovich, Solomon, and Ionescu - less about APIs and more about how Windows works under the hood. Russonovich possibly knows more about this than anyone inside or outside of Microsoft.
0

The Windows API has changed over the years. It's added entirely new sets of functions (ex: TaskDialog and family), and replacements for existing functions (ex: CreateWindowEx).

I'd recommend consulting a newer reference.

3
  • Got any suggestions?
    – gablin
    Jan 24, 2011 at 21:30
  • Sadly, no... I'm not really a C/C++/WinAPI programmer. I just know of the existence of these newer functions.
    – Powerlord
    Jan 24, 2011 at 21:39
  • You mean to tell me a 20 year old OS has added entire new functions over that period of time?! mind = blown
    – MarcusJ
    Jun 29, 2015 at 3:59
0

The Task Scheduler is also new, a lot of new objects & interfaces have been added. Prior to Task Scheduler 2.0, there was around 5 objects involved in scheduling tasks. In 2.0 (introduced when Vista came out), there are 20, no kidding, 20. This is one is the not so great things about win32 programming but its not that bad.

I love programming in win32 you learn so much about how Windows & other OS's operate at a lower level & it makes you a better programmer I believe. If you program in python, you dont learn about how directories are organised, just use os.listdir(""). But when using FindFirstFile() & FindNextFile in win32 you discover how directories are organised, discover the hidden ".." & "." directories & from that can come up with more efficient ways to catalog & search directories.

For win32 resources go to http://groups.google.com/group/comp.os.ms-windows.programmer.win32/topics

Not the answer you're looking for? Browse other questions tagged or ask your own question.