4.3 Callback Functions

As mentioned in the preceding section, the first member of the OLESERVER, OLESERVERDOC, and OLEOBJECT wrapper structures must be an OLESERVER, OLESERVERDOC, or OLEOBJECT structure that points to a corresponding VTBL containing pointers to callback functions for manipulating and handling the server, server document, or object.

You will need to code each of these callbacks so that the server DLL can make meaningful calls into your application. Once you have code in place for the server, document, and object callback functions, you can see how OLE works by double-clicking an embedded object in a client application to start an instance of your server application, set data in an object, instruct the server application to show itself, and so on.

Callback functions are divided into three kinds of OLE manipulation. When creating your server application, you must put callback functions in the appropriate VTBL. The following table shows the server VTBLs and the callback function types for each one:

VTBL Type of Callback Functions

OLESERVERVTBL Fundamental server tasks (opening files, creating objects, and terminating after an editing session)
OLESERVERDOCVTBL Document handling (saving or closing documents, setting document dimensions and color palettes)
OLEOBJECTVTBL Manipulating objects (actions taken upon opening, showing objects, retrieving data in specified formats)