typedef struct _OLECLIENTVTBL { /* ocv */
int (CALLBACK* CallBack)(LPOLECLIENT,
OLE_NOTIFICATION, LPOLEOBJECT);
} OLECLIENTVTBL;
The OLECLIENTVTBL structure contains a pointer to a callback function for the client application.
The address passed as the CallBack member must be created by using the MakeProcInstance function.
INT CALLBACK ClientCallback(lpclient, notification, lpobject)
LPOLECLIENT lpclient;
OLE_NOTIFICATION notification;
LPOLEOBJECT lpobject;
lpclient
Points to the client structure associated with the object. The library retrieves this pointer from its object structure when a notification occurs, uses it to locate the callback function, and passes the pointer to the client structure for the client application's use.
notification
Specifies the reason for the notification. This parameter can be one of the following values:
Value | Meaning |
OLE_CHANGED | The object has changed. Typical actions to take with this notification are to redraw or save the object. |
OLE_CLOSED | The object has been closed in its server. When the client receives this notification, it should not call any function that causes an asynchronous operation until it regains control of program execution. |
OLE_QUERY_PAINT | A lengthy drawing operation is occurring. This notification allows the drawing to be interrupted. |
OLE_QUERY_RETRY | The server has responded to a request indicating that it is busy. This notification requests the client to determine whether the library should continue to make the request. If the callback function returns FALSE, the transaction with the server is discontinued. |
OLE_RELEASE | The object has been released because an asynchronous operation has completed. When all objects have been released the client may quit. The client application can call the OleQueryReleaseError function to determine whether the operation succeeded. It can also call the OleQueryReleaseMethod function, if necessary, to verify that that operation has terminated. |
OLE_RENAMED | The linked object has been renamed in its server. This notification is for information only, because the library automatically updates its link information. |
OLE_SAVED | The linked object has been saved in its server. |
When the client receives the OLE_CLOSED notification, it typically stores the condition and returns to the client library, taking action only when the client library returns control of program execution to the client application. If the client application must take action before regaining control, it should not call any functions that could result in an asynchronous operation.
lpobject
Points to the object that caused the notification to be sent. Applications that use the same client structure for more than one object use the lpobject parameter to distinguish between notifications.
When the notification parameter specifies either OLE_QUERY_PAINT or OLE_QUERY_RETRY, the client should return TRUE if the library should continue, or FALSE to terminate the painting operation or discontinue the server transaction. When the notification parameter does not specify either OLE_QUERY_PAINT or OLE_QUERY_RETRY, the return value is ignored.
The client application should act on these notifications at the next appropriate time; for example, as part of the main event loop or when closing the object. The updating of objects can be deferred until the user requests the update, if the client provides that functionality. The client may call the library from a notification callback function (the library is reentrant). The client should not attempt an asynchronous operation while some other operations are in progress (for example, opening or deleting an object). The client should also not enter a message-dispatch loop inside the callback function. When the client application calls a function that would cause an asynchronous operation, the client library returns OLE_WAIT_FOR_RELEASE when the function is called, notifies the application when the operation completes by using OLE_RELEASE, and returns OLE_BUSY if the client attempts to invoke a conflicting operation while the previous one is in progress. The client can determine if an asynchronous operation is in progress by calling OleQueryReleaseStatus, which returns OLE_BUSY if the operation has not yet completed.
OleQueryReleaseStatus