6.4.2 Opening a Document or Object

Whenever the server library calls the Open, Create, CreateFromTemplate, or Edit function in the OLESERVERVTBL structure, the server creates an OLESERVERDOC structure. If the document is opened by a call from the server library, the server application returns the OLESERVERDOC structure to the library. If the document is opened directly by a user, however, the server should call the OleRegisterServerDoc function to register the document with the library. The library then uses the GetObject function in the OLESERVERDOCVTBL structure to request the server to create an OLEOBJECT structure for each object requested by the client application.

A new instance of the server application is typically started when the client activates a linked or embedded object. This new instance is unnecessary if the object is already open in an instance of the server or if the server is a single-instance (MDI) server that is already open. For more information about the rules for starting new instances of server applications, see Microsoft Windows User Interface Guidelines.

Whether the server library starts a new instance of a server to edit an embedded or linked object depends upon the value specified when the server calls the OleRegisterServer function.