9.8.5 OleUnlockServer

OLESTATUS OleUnlockServer(hServer)

LHSERVER hServer;

The OleUnlockServer function unlocks a server that was locked by calling the OleLockServer function.

Parameter Description

hServer Identifies the server to release from memory. This handle was retrieved by a call to the OleLockServer function.

When the OleLockServer function is called more than once for a given server, the server's lock count is incremented. Each call to the OleUnlockServer function decrements the lock count. The server remains locked until the lock count is zero.

If the OleUnlockServer function returns OLE_WAIT_FOR_RELEASE, the application should call the OleQueryReleaseStatus function to find out whether the unlocking process has completed. In the call to OleQueryReleaseStatus, the application can cast the server handle to a long pointer to an OLE object (LPOLEOBJECT):

OleQueryReleaseStatus((LPOLEOBJECT) lhserver);

When OleQueryReleaseStatus no longer returns OLE_BUSY, the server has been unlocked.

The return value is OLE_OK if successful; otherwise, it could be one of the following:

OLE_ERROR_HANDLE

OLE_WAIT_FOR_RELEASE

See AlsoOleLockServer, OleQueryReleaseStatus