Opening Windows Through the Microsoft API

Interesting, sometimes controversial and insightful. The work seems hurried, incomplete, slapped together.


This is a book that may appeal to a large number of Java programmers working under Windows. Its the first book which is not restricted specifically to the (generally) portable AFC (Application Foundation Classes) or published directly by Microsoft Press. Those elements alone provide a good reason to see what the book has to say.

I’ve read a few of Mark Watson’s books and I have the impression that while he knows what he’s talking about, he doesn’t seem encumbered by a need for high quality workmanship. The end products seem slapped together, hurriedly implemented and tend to have a raw "make it work and ship it kind" of feel. This make the work interesting in the same way a car accident attracts onlookers. On the upside, however, this also provides a glimpse into the workings of a real-world situation, typically encountered by working programmers, and the light tends to shine on areas of the process that are rarely exposed in the slicker books of our day.

This book tends to shine when it comes to small insights along the way. Notes about the AFC being fully portable in the first version, requiring a patch in the second version (observations from real use on Linux and OS/2) and being fully portable in Microsoft’s 3.0 SDK are quite revealing to programmers who haven’t use the AFC in portable projects. The author’s observations about when using Windows-coupled solutions vs. portable code are pragmatic, suggesting that the portability issue is a foremost concern for Java programmers, but that coupling is acceptable if no alternatives exist for a given project. He also talks, in another note, about the IDE and command line environments he switches between, depending on the nature of a project, revealing something about how other programmers really work.

This books is divided into 12 chapters. The foundation in Chapter 1 covers MS SDK 3.0 setup and working with J++ 1.1 (given the recent release of J++ 6.0, this is old news but important in getting the example code working properly). Chapter 2 provides an overview of the AFC and WFC (Windows Foundation Classes) architectures. Chapter 3 implements a newsgroup reader, which provides more of a look at NNTP than Windows programming. Chapter 4 talks about JavaBeans. Chapter 5 demonstrates how you can use the IE (Internet Explorer) engine as an ActiveX control from Java, essentially building a browser component that works when you have IE 4.0 installed on your system. Chapter 6 covers CAB and JAR files, showing how you can create a MS-unsupported JAR file after doing it the Microsoft-centric way with CAB files.

I found Chapter 7 useful in exploring XML and the CDF (Channel Definition Format) used to implement push channels, though the back cover suggestion that a full web server gets implemented is clearly not exact. Real web servers support things like SSL, CGI, Servlets and other critical APIs. Still the example is useful if taken for its intended purpose. It might have been more useful to implement a servlet solution to serve the same objective. Chapter 8 explores the implementation of a custom Windows desktop which is little more than a list and an applet on the active desktop. Chapter 9 talks about three tiered solutions, showing how XML content might be served up from a database.

Chapter 10 will be interesting to game developers, using the Direct3D interface to develop a simple framework for building a planetary navigation-style game. The game is rather simplistic and the Direct3D insights are few, but the chapter is still worth reading. Most of the code is taken from the Microsoft castle example distributed with the SDK. Chapter 11 seemed expendable to me, covering basic JScript/Applet communication. All JavaScript books cover this in the first few chapters and anyone who’s done any web programming is unlikely to learn anything new in these pages. Chapter 11 looks a little deeper with DHTML programming.

The final chapter, Chapter 12, looks at J/Direct programming. J/Direct provides a way for Java programmers to create structure classes, to make native calls and to create callbacks to interact directly with the Windows API. The MsgBox example is straight out of the JDK documentation and the news reader example takes the code from Chapter 3 and wraps it in another example from the JDK to make it possible to call it up from the task bar. The material is well presented but could obviously have been more thoroughly researched. There is no real coverage of more interesting COM/Java interaction issues and pragmatic examples, something still lacking from any of the Windows-specific Java programming books and, in my view, a barrier to any acceptance of this platform-specific approach.

In all, the book’s price tag is a little high but the material is worth reading. The author’s writing style is friendly and easy to read. Small nuggets of wisdom sneak in throughout the book and make it valuable for its objective approach and occasional insights. If you are engaged in a Windows-specific Java implementation, this book may provide you with useful information. It may be especially useful if you are just considering such a project. The examples don’t seem to demonstrate much more than you might find in the SDK but the discussion is frank and more complete than the Microsoft documentation. If you’re swimming in the Microsoft waters, using Java with the AFC, WFC, J/Direct, DirectX or COM, this book is a reasonable investment.