|
49 of 54 people found the following review helpful:
4.0 out of 5 stars
Good introduction with many code examples, June 25, 2001
For reader who has a fairly good background in C++, this book is a good introduction to MFC programming/Visual C++. It is written for individuals who want an in-depth practical understanding of MFC programming, and who are willing to put the time and effort into the learning of it. The book includes a CD which includes the 90 different sample programs in the book. In chapter 1, the author introduces MFC utility objects in console applications. The three utility classes CString, CPoint, and CRect are used to create a simple Windows application. The author is careful to distinguish between a console application, which has the main() function, and a windows program, which does not. The CString class is used, instead of the standard C++ library class, and this is standard in MFC programming. The author advises the reader to think of CString objects as an actual object, and not as a pointer to a string. This is an example of value (or "copy") semantics, wherein the value is copied, and not just the pointer. Programmers concerned about performance issues commonly use this feature of C++. The author gives an interesting method to extract a string from a stream into a CString object, and how to use the Format() function to convert a value to a string for eventual display in a window. A review of classes in C++ is given in Chapter 2, with emphasis on how virtual functions get executed in windows applications. The author shows explicitly how to use Visual Studio to add a class and member functions, and a good discussion is given on the difference between passing parameters by value, by reference, and by pointer. The role of the member function "this" is discussed also. Chapter 3 could be skipped by the reader interested only in MFC windows applications, according to the author, where he discusses collections and class templates. Object and pointer array collections are treated via the code examples. The author discusses the three different ways of performing tasks on collections, and discusses how to use pointers to objects, which is very advantageous from a memory management point of view. He is also gives an interesting discussion on serialization. The actual building of MFC Windows programs begins in Chapter 4, without using the AppWizard. The event handling via keyboard and mouse input is given the main emphasis, and the author gives a detailed discussion on the steps taken by a window event. The different types of member functions in the CMainFrame class are given a thorough treatment. The reader is first asked to use an MFC virtual function in this chapter. In the next chapter, the author shows how to get graphics shapes in the windows, via device context attributes. This is followed in Chapter 6 by a discussion on how to use the mouse and keyboard to make changes to text and graphics. The window controls are then discussed in Chapter 7, and the author gives a very detailed discussion on how controls fit in to CMainFrame. The process by which event and notification messages are handled is summarized in a diagram. List boxes, combo boxes, and scroll bars are all treated in detail using the example programs. This is followed naturally in Chapter 8 by a discussion of menus and dialog boxes in the context of resource editors. Finally in Chapter 9, the author uses the AppWizard to generate an application. A simple program example begins the discussion, followed by a non-document application. The author carefully explains the steps used in the AppWizard to give the reader more insight on just how it is able to do its job. Then in Chapter 10, the AppWizard and the ClassWizard are used to refine and extend the discussion on menus, toolbars, and dialogs. A good program example is given for a dialog-based application. Time-dependent messaging and XOR drawing mode are the subjects of the next chapter. The three functions for timer control are discussed, along with a discussion of animation. This is followed in Chapter 12 by a treatment of bitmap graphics, with bitmap editors via MS Paint discussed. Messaging via the MFC functions SendMessage() and PostMessage() is discussed in Chapter 13. These functions are discussed in a setting more general than modeless dialogs. Modeless dialogs are however discussed in detail in the chapter, and the difference between modal and modeless dialogs clearly explained. The next chapter of the book discusses how to use the document view architecture and the author shows in detail the major classes involved in its use. The reader can see the CMainFrame object as a container object, which will adjust the sizes of the windows it contains if the mainframe window is resized. The document and view classes are derived from the CDocument and CView classes. The discussion is helpful in that it shows how to use the member functions in these classes to propagate information to all views. The author also shows how to serialize the document objects. In the last chapter the author shows the reader how to use Visual C++ to manipulate an existing ODBC database. The discussion is very brief, but it does the reader with database knowledge of how to generate code to interact with these databases.
Help other customers find the most helpful reviews
Was this review helpful to you?
|
|
|
|