Active Document Servers

HomeOverviewHow Do I

Active document servers such as Microsoft Office Binder or Internet Explorer host documents of other application types called Active documents. Unlike OLE embedded objects (which are simply displayed within the page of another document), Active documents provide the full interface and complete native functionality of the server application that creates them. Users can create documents using the full power of their favorite applications (if they are Active document enabled), yet can treat the resulting project as a single entity.

Active documents can have more than one page and are always in-place active. Active documents control part of the user interface, merging their menus with the File and Help menus of the container. They occupy the entire editing area of the container and control the views and the layout of the printer page (margins, footers, and so on).

MFC implements Active document servers with document/view interfaces, command dispatch maps, printing, menu management, and registry management. Specific programming requirements are discussed in Active documents.

MFC supports Active documents with the CDocObjectServer class, derived from CCmdTarget, and CDocObjectServerItem, derived from COleServerItem. MFC supports Active document containers with the COleDocObjectItem class, derived from COleClientItem.

CDocObjectServer maps the Active document interfaces and initializes and activates an Active document. MFC also provides macros to handle command routing in Active documents. To use Active documents in your application, include AfxDocOb.h in your StdAfx.h file.

A regular MFC server hooks up its own COleServerItem-derived class. MFC AppWizard generates this class for you if you select the Mini-server or Full-server check box to give your application server compound document support. If you also select the Active document server check box, AppWizard will generate a class derived from CDocObjectServerItem instead.

The COleDocObjectItem class allows an OLE container to become an Active document container. You can use the MFC AppWizard to create an Active document container by selecting the Active document container checkbox in Step 3 of the MFC AppWizard. For more information, see Creating an Active Document Container Application.