- 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
- 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
- Just What Is an Active Document?
- Some Details About Active Documents
- The COM Interfaces
- The Active Template Library
- The ACTIVEDOC Program
- Summary
- 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
Just What Is an Active Document?
Active documents are an evolved form of OLE documents that originally were designed to enable users to view an OLE document inside a Web browser. In particular, Active documents are OLE embedded documents with the addition of four new COM interfaces: IOleDocument, IOleDocumentView, IOleCommandTarget, and IPrint. These new interfaces allow for a significant difference between OLE embedded documents and Active documents: Active documents occupy the entire client area of its container, whereas OLE embedded documents occupy a small, well-defined area. This ability to occupy the entire client area was added so that users browsing the Web with a tool such as Internet Explorer could click a hyperlink on a Web page and link directly to a Microsoft Word document, Microsoft Excel spreadsheet, or another application. To users, it appears as though the application data is just another Web page with perhaps more menu items and toolbars. This provides users with a positive and rich Internet experience.
Active documents first appeared with the release of Microsoft Office 95. Microsoft Office Binder is an Active container, and Microsoft Word and the other Office applications are Active documents. In fact, it is quite interesting to notice the following in the Visual C++ header DOCOBJ.H:
#define IMsoDocument IOleDocument #define IMsoView IOleDocumentView
Clearly, the IOleDocument and IOleDocumentView interfaces began life as Microsoft Office (Mso) interfaces. Also, Active documents originally were referred to as DocObjects. You will notice API calls and interfaces that reference this name—for ex ample, the MFC class CDocObjectServer.
Let's look a little more closely at the four new COM interfaces:
- IOleDocument is one of the new required interfaces. It allows the container to determine various attributes about the document, to enumerate the views that are supported, and to create specific views.
- IOleDocumentView is another required new interface. It is the interface the container uses to communicate with the view. Each view must support this interface in addition to existing OLE interfaces, such as IOleInPlaceObject and IOleInPlaceActiveObject.
- IOleCommandTarget is an optional interface. It allows the container to route commands that it doesn't handle to the document. The container also exposes this interface and allows the document to route commands to the container.
- IPrint is an optional interface. It allows the container to print the contents of the document and to specify to the document what to print and how to print it. This interface works with IContinueCallback which the container exposes. IContinueCallback allows the document to update the container on printing status and allows the container to cancel printing in progress.
Two MFC classes encapsulate the Active document interfaces: CDocObjectServer and CDocObjectServerItem. CDocObjectServer supports the IOleDocument, IOleDocumentView, IOleCommandTarget, and IPrint interfaces. CDocObjectServer is similar to what COleDocument does and replaces this class when you want to support Active documents. CDocObjectServerItem supports OLE server verbs required for Active documents. It derives from COleServerItem and overrides OnHide, OnOpen, and OnShow to implement Active document support. It replaces COleServerItem when you want to support Active documents.
Some Details About Active Documents | Next Section

Account Sign In
View your cart