6.3.3 Object Manipulation Functions That Can Be Modified

Once the object handler has been invoked by one of the object-creation functions, a copy of the OLEOBJECTVTBL is created that includes pointers to the object-manipulation functions that can be modified. The following is a list of the object-manipulation functions.

Delete

SetHostNames

SaveToStream

Clone

CopyFromLink

Equal

CopyToClipboard

Draw

Activate

Execute

Close

Update

Reconnect

ObjectConvert

GetLinkUpdateOptions

SetLinkUpdateOptions

Rename

QueryName

QueryType

QueryBounds

QuerySize

QueryOpen

QueryOutOfDate

QueryReleaseStatus

QueryReleaseError

QueryReleaseMethod

RequestData

ObjectLong

Note All of the preceding functions correspond to OleFunctionName APIs, except for ObjectLong, which is provided for handlers and allows handler-specific data to be pointed to in the VTBL. For example, OleDraw is part of the OLECLI.DLL API, and calls a function named Draw inside OLECLI.DLL.

6.3.3.1 OLEOBJECTVTBL Example

The OLEOBJECTVTBL structure normally points to callback functions that the server application uses. If only a server application is being created, the constant SERVERONLY is defined with #DEFINE and the second half of OLEOBJECTVTBL (as defined in the header file, OLE.H) is not created.

To use the object manipulation functions (beginning with Delete), the handler must have a copy of OLEOBJECTVTBL and initialize it when the handler is invoked by one of the object-creation function calls from the client application. When creating a handler, do not define SERVERONLY by the #DEFINE preprocessor directive, or the object-creation half of the table will not be created.

Also, do not use the /DSERVERONLY command-line option when compiling an object handler.

The following sample code shows the OLEOBJECTVTBL structure, as defined in OLE.H:

typedef struct _OLEOBJECTVTBL

{

void FAR* (CALLBACK* QueryProtocol) (LPOLEOBJECT, OLE_LPCSTR);

OLESTATUS (CALLBACK* Release) (LPOLEOBJECT);

OLESTATUS (CALLBACK* Show) (LPOLEOBJECT, BOOL);

OLESTATUS (CALLBACK* DoVerb) (LPOLEOBJECT, UINT, BOOL, BOOL);

OLESTATUS (CALLBACK* GetData) (LPOLEOBJECT, OLECLIPFORMAT, HANDLE FAR*);

OLESTATUS (CALLBACK* SetData) (LPOLEOBJECT, OLECLIPFORMAT, HANDLE);

OLESTATUS (CALLBACK* SetTargetDevice) (LPOLEOBJECT, HGLOBAL);

OLESTATUS (CALLBACK* SetBounds) (LPOLEOBJECT, OLE_CONST RECT FAR*);

OLECLIPFORMAT (CALLBACK* EnumFormats) (LPOLEOBJECT, OLECLIPFORMAT);

OLESTATUS (CALLBACK* SetColorScheme) (LPOLEOBJECT, OLE_CONST LOGPALETTE FAR*);

/* Server has to implement only the above methods. */

#ifndef SERVERONLY

/* Extra methods required for client. */

OLESTATUS (CALLBACK* Delete) (LPOLEOBJECT);

OLESTATUS (CALLBACK* SetHostNames) (LPOLEOBJECT, OLE_LPCSTR, OLE_LPCSTR);

OLESTATUS (CALLBACK* SaveToStream) (LPOLEOBJECT, LPOLESTREAM);

OLESTATUS (CALLBACK* Clone) (LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR, LPOLEOBJECT FAR*);

OLESTATUS (CALLBACK* CopyFromLink) (LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR, LPOLEOBJECT FAR*);

OLESTATUS (CALLBACK* Equal) (LPOLEOBJECT, LPOLEOBJECT);

OLESTATUS (CALLBACK* CopyToClipboard) (LPOLEOBJECT);

OLESTATUS (CALLBACK* Draw) (LPOLEOBJECT, HDC, OLE_CONST RECT FAR*, OLE_CONST RECT FAR*, HDC);

OLESTATUS (CALLBACK* Activate) (LPOLEOBJECT, UINT, BOOL, BOOL, HWND, OLE_CONST RECT FAR*);

OLESTATUS (CALLBACK* Execute) (LPOLEOBJECT, HGLOBAL, UINT);

OLESTATUS (CALLBACK* Close) (LPOLEOBJECT);

OLESTATUS (CALLBACK* Update) (LPOLEOBJECT);

OLESTATUS (CALLBACK* Reconnect) (LPOLEOBJECT);

OLESTATUS (CALLBACK* ObjectConvert) (LPOLEOBJECT, OLE_LPCSTR, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR, LPOLEOBJECT FAR*);

OLESTATUS (CALLBACK* GetLinkUpdateOptions)

(LPOLEOBJECT, OLEOPT_UPDATE FAR*);

OLESTATUS (CALLBACK* SetLinkUpdateOptions)

(LPOLEOBJECT, OLEOPT_UPDATE);

OLESTATUS (CALLBACK* Rename) (LPOLEOBJECT, OLE_LPCSTR);

OLESTATUS (CALLBACK* QueryName) (LPOLEOBJECT, LPSTR, UINT FAR*);

OLESTATUS (CALLBACK* QueryType) (LPOLEOBJECT, LONG FAR*);

OLESTATUS (CALLBACK* QueryBounds) (LPOLEOBJECT, RECT FAR*);

OLESTATUS (CALLBACK* QuerySize) (LPOLEOBJECT, DWORD FAR*);

OLESTATUS (CALLBACK* QueryOpen) (LPOLEOBJECT);

OLESTATUS (CALLBACK* QueryOutOfDate) (LPOLEOBJECT);

OLESTATUS (CALLBACK* QueryReleaseStatus) (LPOLEOBJECT);

OLESTATUS (CALLBACK* QueryReleaseError) (LPOLEOBJECT);

OLE_RELEASE_METHOD (CALLBACK* QueryReleaseMethod) (LPOLEOBJECT);

OLESTATUS (CALLBACK* RequestData) (LPOLEOBJECT, OLECLIPFORMAT);

OLESTATUS (CALLBACK* ObjectLong) (LPOLEOBJECT, UINT, LONG FAR*);

/* This method is internal only */

OLESTATUS (CALLBACK* ChangeData) (LPOLEOBJECT, HANDLE, LPOLECLIENT, BOOL);

#endif /* !SERVERONLY */

} OLEOBJECTVTBL;