Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

Just What Is an Active Document Container?

What an exciting industry to work in! Just when you think you have it all figured out, it seems as though everything changes. It wasn't that long ago when Microsoft was all jazzed about compound documents—the capability for the user to combine graphics, text, and data in one document. Now, with ActiveX and other Active technologies, it appears as though this has all gone away and everything is suddenly enabled for the Internet and intranets! Not to worry: Everything you know about OLE technology still applies. It's just been extended to cover new opportunities. As this chapter unfolds, you will see how existing OLE container support has been enhanced with new COM interfaces and how MFCs have been extended to support these interfaces. If you're new to COM, OLE, and ActiveX, you're in the right place. You'll find all the information you need to understand how active document containers work.

So what is an active document container? The short answer is that an active document container is an OLE container with some new COM interfaces—in particular, IOleCommandTarget, IOleDocumentSite, and IContinueCallback. These new interfaces have been added to support corresponding new interfaces in active documents. These interfaces first appeared in the Microsoft Office Binder application. Binder, as well as Internet Explorer, are active document containers. Active documents differ from OLE embedded documents in that they occupy the entire client area of the container and control more of the menu. To the user, the active document container appears to be the native application frame window. If you create a new Binder document and insert a Word document, an Excel spreadsheet, or a PowerPoint presentation, you notice that as you click each component of the binder that the user interface changes and the menus and toolbars appear as they would in the native application. This capability of the container to take on the appearance of any native application is what active document containers are all about. They allow the Binder application to bind together several applications into one file, and they enable Internet Explorer to download and display any active document data from a Web server.

Let's explore these new interfaces further. The IOleCommandTarget interface allows menu commands or other actions to be routed from the active document to the active document container. A corresponding IOleCommandTarget interface is defined for the active document. This corresponding interface allows the container to route menu commands and other actions to the document. This allows a bi-directional communication of commands to flow cooperatively between container and document. The effect to the user is that the container and document behave as a unified application. The user is unable to tell which piece of software supplies support for which menu item. Supporting the IOleCommandTarget interface is optional.

The IOleDocumentSite COM interface provides one method: ActivateMe, which allows the document server to ask the container to activate the document as a full active document instead of an OLE in-place embedded object.

The IContinueCallback COM interface provides printing support. It is used with the IPrint COM interface that the active document server exposes. The document server uses this interface to provide progress information to the container and to give the container the opportunity to cancel the printing operation.

Share ThisShare This

Informit Network