Поделиться через


Servers: Implementing Server Documents

This article explains the steps you must take to successfully implement a server document if you did not specify the OLE Server option in the application wizard.

To define a server document class

  1. Derive your document class from COleServerDoc instead of CDocument.

  2. Create a server item class derived from COleServerItem.

  3. Implement the OnGetEmbeddedItem member function of your server document class.

    OnGetEmbeddedItem is called when the user of a container application creates or edits an embedded item. It should return an item representing the entire document. This should be an object of your COleServerItem-derived class.

  4. Override the Serialize member function to serialize the contents of the document. You do not need to serialize the list of server items unless you are using them to represent the native data in your document. For more information, see Implementing Server Items in the article Servers: Server Items.

When a server document is created, the framework automatically registers the document with the OLE system DLLs. This allows the DLLs to identify the server documents.

For more information, see COleServerItem and COleServerDoc in the Class Library Reference.

См. также

Основные понятия

Servers

Servers: Server Items

Servers: Implementing a Server

Servers: Implementing In-Place Frame Windows