INF: OLE Methods and Callbacks Must Not Call OLE Functions

ID Number: Q83018

3.10

WINDOWS

Summary:

In an application developed using the object linking and embedding

(OLE) libraries, any callback function (also known as a method) must

not call any OLE library function. An application can call an OLE

function only outside the context of the callback functions, which

include all functions referred to in the OLECLIENTVTBL, OLESTREAMVTBL,

OLEOBJECTVTBL, OLESERVERVTBL, and OLESERVERDOCVTBL structures defined

in the OLE.H header file.

Windows calls a callback function while the OLE libraries are

performing an asynchronous operation. Any object affected during the

operation is marked as busy; therefore, calling any OLE function that

may affect that object is forbidden.

Most OLE functions return an error code when used from a callback

function. The one exception to this rule is during processing of the

OLESERVERDOC Close method. When this method is called, the server

application must call OleRevokeServerDoc. If this call generates an

OLE_WAIT_FOR_RELEASE return code, the server ignores the returned

value. The OLE server library calls the Close method to close a

document unconditionally.