7.1.5 The OLESERVERVTBL Structure

The following code example shows the OLESERVERVTBL data structure as defined in OLE.H. This structure points to application-specific callback functions that are used to manipulate a server application. After a server application creates this structure and a corresponding OLESERVER structure (which points to OLESERVERVTBL), the server DLL can make calls to the server application.

typedef struct _OLESERVERVTBL

{

OLESTATUS (CALLBACK* Open) (LPOLESERVER, LHSERVERDOC, OLE_LPCSTR,

LPOLESERVERDOC FAR*);

OLESTATUS (CALLBACK* Create)(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR,

OLE_LPCSTR, LPOLESERVERDOC FAR*);

OLESTATUS (CALLBACK* CreateFromTemplate)(LPOLESERVER, LHSERVERDOC,

OLE_LPCSTR, OLE_LPCSTR,

OLE_LPCSTR, LPOLESERVERDOC

FAR*);

OLESTATUS (CALLBACK* Edit) (LPOLESERVER, LHSERVERDOC, OLE_LPCSTR,

OLE_LPCSTR, LPOLESERVERDOC FAR*);

OLESTATUS (CALLBACK* Exit) (LPOLESERVER);

OLESTATUS (CALLBACK* Release) (LPOLESERVER);

OLESTATUS (CALLBACK* Execute)(LPOLESERVER, HGLOBAL);

} OLESERVERVTBL;

7.1.5.1 OLESERVERVTBL Members

The following table lists the OLESERVERVTBL data structure members; each member points to a specific callback function.

Structure MemberDescription

Open Opens an existing document in preparation for editing.
Create Opens a new document.
CreateFromTemplate Creates a new document and initializes it with the data from a specified file.
Edit Creates a document that is initialized with data retrieved by a subsequent call to the SetData function.
Exit Instructs the server application to close documents and terminate (simply terminate if no documents are registered).
Release Notifies a server that all connections to it have closed and that it is safe to terminate.
Execute Specifies DDE execute strings.