Book Reviews


Inside Visual C++

reviewed by Clyde Sickler


Clyde Sickler is a consultant with over two decades of experience developing operating systems, communications architectures, and distributed applications. He is currently managing the development of some Windows-based client-server applications for MCI. He can be reached on Compuserve at 76600,1652 or by mail at P.O. Box 200363, Arlington, TX 76006.

Visual C++ is Microsoft's follow-on to its C-oriented Software Development Kit. Visual C++ is an integrated development environment tailored to creation of Windows applications. Microsoft also developed an Application Framework for C++ developers, which became Microsoft Foundation Class (MFC) library. MFC provides an assortment of classes both to structure a Windows application, and to encapsulate a lot of built-in functionality. The Visual C++ environment supports the use of MFC by providing tools to generate a "functional" skeleton application, (the Application Wizard), to define the resources (the Application Studio), and to tie resources, messages, commands, and class members together (the Class Wizard).

Just as Petzold's Programming Windows was written for a generation of C-based Windows developers, Kruglinksi's Inside Visual C++ is written for those who want to exploit MFC. Anyone who uses MFC will find this book useful, but obviously those who also program with Visual C++ benefit from it the most. Windows beginners should be aware that this book assumes a certain non-trivial knowledge of Windows programming. For example, the book does not plumb the depth and breadth of writing DLLs, but does explain how to extend the MFC DLL with Visual C++, and how to write your own DLLs using Visual C++ as a tool. Although the author patiently explains many aspects of Windows programming, he mainly focuses on how to use the Visual C++ environment and the Application Framework as tools. To this end he does an admirable job of explaining how the various classes work together, and how they encapsulate and support Windows behavior.

Kruglinski begins with an overview of the Visual C++ Integrated Development Environment, and then explains how to optimize it and exploit its many features. Through a series of graduated examples, he leads the reader to a growing understanding of how to use the IDE and the classes to develop increasingly more interesting Windows applications, explaining key concepts as they arise. Although the book comes with a diskette containing the code examples, I found that working through an example didn't always provide the depth of understanding I wanted. Sometimes I learned more by struggling through a topic on my own. An example of such a topic is the discussion on the GDI in Chapter 5. In other cases, the examples and commentary were sufficient to get me started, which was what I needed the most. Chapter 8 presents such a topic — Visual Basic Controls; following along with this chapter will probably be adequate for most people.

One area covered by the book may prove particularly valuable to those new to MFC and the Application Framework. The book provides an extended discussion of the Application Framework's classes for structuring applications, particularly which function goes where within those classes. This discussion spans several chapters as the author walks us through several different examples. A couple of key concepts illustrated here include how to split a function between a document object and a view object, and the subtle differences between SDI and MDI applications.

In addition to helping us discover the MFC as it exists, the author shows ways to further exploit the power of objects. For example, he shows us a persistent base class for SDI frame windows, a class for Device Independent Bitmaps, and a class that supports a row view of relational databases. The author's apparent love for object technology shines through in several places, not the least of which is in the appendix explaining class design.

Benefiting from Experience

In many places the author shares some hard-won wisdom and practical experience with us, as in his note on p. 122 which discusses an apparent blind spot in the Application Studio. Also, when he modifies a class's behavior, he is usually diligent to explain why. This improves our understanding of MFC, and gives us practical examples of the power of inheritance. (Of course, no one is perfect — there are also a few cases where he didn't give as much of an explanation as I'd like.) Experience as a writer evidently cultivates tact, which the author displays as he explains how to work around some bugs in the IDE (one having to do with CFormView and Class Wizard).

In addition to the above subjects, the book provides several good discussions on such useful topics as memory management, periodically releasing control for other applications, context sensitive help, serialization of objects, printing and print preview, the relationship between menu items and message and command handlers, toolbars and status bars, and owner-draw bitmap buttons.

Conclusion

As useful as this book is, it is somewhat dated now by the release of Visual C++ 1.5 and MFC 2.5, as the chapters on ODBC and OLE do not reflect the improvements in these areas (and the example on OLE needs redesign). I for one would like to see a book as useful as this updated periodically to keep pace with the improvements in Visual C++. I think Kruglinski's Inside Visual C++ will help many readers take full advantage of its features.

Title: Inside Visual C++
Author: David J. Kruglinksi
Publisher: Microsoft Press, 1-800-MSPRESS
Price: $39.95
ISBN: 1-55615-511-5
Pages: 598, Includes diskette