Knowledge Base

How To Print from an Active Document Server

Article ID: 180152

Article Last Modified on 7/1/2004


APPLIES TO


This article was previously published under Q180152

SUMMARY

This article explains how to print from an Active Document (DocObject) server while the server is in-place activated in an Active Document container.

MORE INFORMATION

An Active Document server provides a mechanism for viewing the contents of a document within a single container, such as Microsoft Internet Explorer or Microsoft Office Binder. Active documents are displayed in the entire client area of the container, are involved in menu merging, and are always in-place active.

Microsoft Visual C++ provides an AppWizard that can help you create an Active Document server implemented using the Microsoft Foundation Classes (MFC).

When an Active document is in-place activated, a user may want to print the contents of the document using the Print menu item available on the container File menu. To provide this functionality in an MFC Active document server, perform the following steps:

  1. Declare an OLE command map in the declaration file for your COleServerDoc-derived class as follows:
          class CMyOleServerDoc : public COleServerDoc
          {
             ...
          protected:
             DECLARE_OLECMD_MAP()
          };
    						
  2. Implement the OLE command map in the implementation file for your COleServerDoc-derived class as follows:
          BEGIN_OLECMD_MAP(CMyOleServerDoc, COleServerDoc)
             ON_OLECMD_PRINT()    // Implements OLE printing
          END_OLECMD_MAP()
    						

REFERENCES

"Inside OLE" by Kraig Brockschmidt, published by Microsoft Press. "Understanding ActiveX and OLE" by David Chappell, published by Microsoft Press.

Additional query words: print ON_OLECMD_PRINT Active document DocObj

Keywords: kbhowto kbprint kbwizard KB180152