Friday 3 October 2008

The Relevance of Charles Petzold's Programming Windows in a Modern .NET World

Charles Petzold has released a new book on 3D Programming using WPF. He is best known for his classic tome Programming Windows (using C and the Win32 API). But is this "Windows programmers bible" still relevant in today's world of .NET? Windows Joe takes a look....

Some might say that the Mighty Programming Windows using C and the Windows API is a topic only of historical relevance. Certainly the modern .NET programmer has no business using the Windows API in day-to-day programming ...in theory. What happens when an API function isn't exposed in the .NET framework. Well, we could just expose it manually in .NET and be done with it ....do we really need to know what's going on inside, or read a thousand plus pages to work out Windows' inner workings?

It all boils down to one thing. Do you WANT to be the best Windows programmer in the world or don't you? If the answer is an unwavering, unhesitating YES then you NEED, I repeat, NEED, to read Charles' book on Programming Windows quick-time. Don't delay.

Charles talks about the history of Windows and facts every aficionado of the operating system should know of the top of their hat - starting from Windows 1.0 "tiled windows" release in November 1985, the year "Iron Mike"/"The Baddest Man on the Planet" made his professional debut in Albany, NY, moving on to Windows 2.0 in 1987 (overlapping windows), the year the NY Giants defeated the Denver Broncos in the SuperBowl, then Windows 3.0 in 1990 (support for 16-bit protected mode in 286 and upwards), the year 300,000 people in Lithuania demonstrated for independence.

In April 1992, the legendary Windows 3.1 was released (a few months later in September, Black Wednesday took place, knocking the pound and lira out of the ERM). Hello TrueType fonts, OLE (remember OCX controls?) and standardized dialog boxes. Then Win95 in 1995 and Win98 in 1998. Charles summarises that the "Windows API has remained quite consistent since Windows 1.0" except in the area of function calls: "Windows 1.0 supported fewer than 450 function calls; today there are thousands". He also underlines the differences between Win16 and Win32. If you don't know about this, read the book.

The first program, which starts with #include windows.h (a header that includes a bunch of other headers like winbase.h for kernel functions) is the canonical start file for a Win32 program. Ah, the joys of WinMain!

No comments: