You will need to write your own application-specific wrapper data structures, keeping the OLESERVER, OLESERVERDOC, or OLEOBJECT structure as the first member, and adding any additional data required by your application. A wrapper is a structure that has another structure as one of its members.
The OLE DLLs are unaffected by the additional data, since they only handle the predefined OLESERVER, OLESERVERDOC, or OLEOBJECT data at the beginning of these structures. The OLE libraries pass these structures back to the server application as parameters to the server's callback functions; any additional data appended to the data structure can be easily accessed by the server application by casting the pointer to the application-specific wrapper structure. You can name these wrapper structures anything you like.
The following code example shows a wrapper structure that includes the OLESERVERDOC structure as its first member (as defined for the sample program SRVRDEMO.EXE):
typedef struct
{
OLESERVERDOC oledoc; //This must be first field so
//that an LPOLESERVERDOC can
//be cast to DOC *
LHSERVERDOClhdoc; //Registration handle
DOCTYPEdoctype; //Document name
HPALETTEhpal; //Handle to a color palette
BYTErgfObjNums[cfObjNums+1]; //What object numbers have
//been used
}DOC, *DOCPTR;
For more information about the OLE data structures, see Chapter 7, "Callback Functions and Data Structures."