When a client application starts, it should follow these steps:
1.Register the clipboard formats that it requires.
2.Allocate and initialize as many OLECLIENT structures as required.
3.Allocate and initialize an OLESTREAM structure.
A client application can register the clipboard formats by calling the RegisterClipboardFormat function for each format, specifying such formats as Native, OwnerLink, ObjectLink, and any other formats it requires.
A client application uses two structures to receive information from the client library: OLECLIENT and OLESTREAM.
The OLECLIENT structure points to an OLECLIENTVTBL structure, which
in turn points to a callback function supplied by the client application. The OLE
libraries use this callback function to notify the client of any changes to an object. The parameters for the callback function are a pointer to the client structure, a pointer to the relevant object, and a value giving the reason for the notification. Typically, an application creates one OLECLIENT structure for each OLEOBJECT structure. Having a separate OLECLIENT structure for each object allows an application to take object-specific action in response to the OLE_QUERY_PAINT callback notification.
The OLECLIENT structure can also point to data that describes the state of an object. This data, when present, is supplied and used only by the client application. The client application allocates a separate OLECLIENT structure for each object and stores state information about that object in the structure. Because one argument to the callback function is a pointer to the OLECLIENT structure, this is an efficient method of retrieving the object's state information when the callback function is called.
The OLESTREAM structure points to an OLESTREAMVTBL structure, which is a table of pointers to client-supplied functions for stream input and output. The client libraries use these functions when loading and saving objects. A client can customize functions for particular situations, and a client can make such changes as varying the permanent storage for an object; for example, a client could store an object in a database, instead of in a file with the rest of the document.
The client application should create a pointer to the callback function in the OLECLIENTVTBL structure and pointers to the functions in the OLESTREAMVTBL structure by using the MakeProcInstance function. Callback functions should be exported in the module-definition file.