4.4 Starting a Server Application

An OLE server application must do certain things every time an instance of the server application is initialized. Instance initialization takes place before the application has displayed its main window and entered the message processing loop.

Every time an instance of the server application is initialized, the server must do the following:

Register clipboard formats for Native, OwnerLink, and ObjectLink types.

Initialize VTBLs, creating instance thunks for the server, document, and object callback functions.

Initialize and register the OLESERVER structure.

Register the server application with the server DLL by calling OleRegisterServer.

Parse the command line to see if the server application is starting for a linked or embedded object.

Allocate and initialize the initial OLESERVERDOC structure (optional, only done if a filename is specified when the server application is started).

Register the initial document with OleRegisterServerDoc (optional, only if a filename is specified when the server application is started).

Note Before the first instance of your application can be initialized, your server application must be registered in the system registration database. The registration database provides a system-wide source of information about those server applications that support the OLE protocol. The database lists the names of the executable files for the OLE applications, the verbs available for the classes of objects, and whether an object-handler library exists for a given class of object. For more information about registering a server application, see Chapter 10, "Using The Registration Database."