- Table of Contents
- Copyright
- About the Authors
- About the Contributors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- How to Use This Book
- What You Need to Use This Book
- What's New in Visual C++ 6.0
- Contacting the Main Author
- Part I: Introduction
- Chapter 1. The Visual C++ 6.0 Environment
- Part II: MFC Programming
- Chapter 2. MFC Class Library Overview
- Chapter 3. MFC Message Handling Mechanism
- Chapter 4. The Document View Architecture
- Chapter 5. Creating and Using Dialog Boxes
- Chapter 6. Working with Device Contexts and GDI Objects
- Chapter 7. Creating and Using Property Sheets
- Understanding Property Sheets
- Creating a Property Sheet
- Responding to Property Sheet Messages
- Customizing the Standard Property Sheet
- Understanding the Win32 Sequence of Events
- Summary
- Chapter 8. Working with the File System
- Chapter 9. Using Serialization with File and Archive Objects
- Part III: Internet Programming with MFC
- Chapter 10. MFC and the Internet Server API (ISAPI)
- Chapter 11. The WinInet API
- Chapter 12. MFC HTML Support
- Part IV: Advanced Programming Topics
- Chapter 13. Using the Standard C++ Library
- Chapter 14. Error Detection and Exception Handling Techniques
- Chapter 15. Debugging and Profiling Strategies
- Chapter 16. Multithreading
- Chapter 17. Using Scripting and Other Tools to Automate the Visual C++ IDE
- Part V: Database Programming
- Chapter 18. Creating Custom AppWizards
- Chapter 19. Database Overview
- Chapter 20. ODBC Programming
- Chapter 21. MFC Database Classes
- Chapter 22. Using OLE DB
- Chapter 23. Programming with ADO
- Part VI: MFC Support for COM and ActiveX
- Chapter 24. Overview of COM and Active Technologies
- Chapter 25. Active Documents
- Chapter 26. Active Containers
- Chapter 27. Active Servers
- Chapter 28. ActiveX Controls
- Part VII: Using the Active Template Library
- Chapter 29. ATL Architecture
- Chapter 30. Creating COM Objects Using ATL
- Chapter 31. Creating ActiveX Controls Using ATL
- Chapter 32. Using ATL to Create MTS and COM+ Components
- Part VIII: Finishing Touches
- Chapter 33. Adding Windows Help
- Part IX: Appendix
Understanding the Win32 Sequence of Events
This section gives a brief overview of the structure and sequence of events down at the Win32 level. Unless you like a challenge and have loads of spare time, you won't actually need to implement a property sheet using the direct API calls and structures. Instead, you will use the MFC (or Active Template Library) wrapper classes (discussed in the previous sections), which greatly simplify the process. However, it is worth a brief discussion of these events to understand the processes underlying the wrapper classes.
Before the property sheet is displayed, each page is added to a PROPSHEETHEADER structure in memory as a pointer to a PROPSHEETPAGE structure and corresponding window handle.
When the property sheet is displayed initially, the first page is displayed and sent a WM_INITDIALOG message. If the user then selects another page, the first page is hidden and the new dialog box is displayed and sent a WM_INITDIALOG message. If the user then reselects a previously displayed (but now hidden) page, the reselected page is redisplayed, but no WM_INITDIALOG message is sent.
This sequence of events sent by Windows indicates that each of the dialog boxes comprising the pages of the property sheet is modeless, with the overall modality controlled by the parent property sheet itself.
Except for the initial page, the dialog boxes for each page are never created unless the user specifically selects the tab for that page. However, once created, the individual dialog boxes stay created until the property sheet itself is destroyed. The created dialog boxes are merely hidden when their tab isn't currently active. You can see this in action by using the Visual Studio Spy++ IDE tool to study the window's hierarchy while a property sheet (such as the Internet control panel applet) is displayed.
Obviously, there will be times when you'll need to validate the details on a particular page before allowing the user to select another page. You can perform this validation from the currently active page when the tab control sends it a PSN_KILLACTIVE notification message. To keep the current page active, you can set a TRUE message result value in response to the notification. Alternatively, a FALSE message result allows the selection to continue resulting in a PSN_SETACTIVE notification being sent to the newly activated page. You can use the PSN_SETACTIVE notification to initialize or reinitialize any controls in the newly activated tab.
After a user clicks the OK or Apply property sheet button, a PSN_APPLY message is sent to each of the property pages to let you take whatever appropriate action is required for each page. When the OK or Cancel button is pressed, the property sheet is closed and all the property page and property sheet windows are destroyed. However, the convention is that Apply should implement the changes specified by the modified control settings without closing the property sheet.
Summary | Next Section

Account Sign In
View your cart