OLESTATUS OleLockServer(lpObject, lphServer) | |||||
LPOLEOBJECT lpObject; | /* pointer to object | */ | |||
LHSERVER FAR* lphServer; | /* pointer to handle of server | */ |
The OleLockServer function is called by a client application to keep an open server application in memory. Keeping the server application in memory allows the client library to use the server application to open objects quickly.
lpObject
Points to an object the client library uses to identify the open server application to keep in memory. When the server has been locked, this pointer can be deleted.
lphServer
Points to a handle to the server application when the function returns.
The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which can be OLE_ERROR_OBJECT, OLE_ERROR_LAUNCH, or OLE_ERROR_COMM.
A client calls the OleLockServer function to speed the opening of objects when the same server is used for a number of different objects. Before the client terminates it must call the OleUnlockServer function, to release the server from memory.
When OleLockServer is called more than once for a given server, even by different client applications, the server's lock count is increased. Each call to the OleUnlockServer function decrements the lock count. The server remains locked until the lock count is zero. If the object identified by the lpObject parameter is deleted before calling the OleUnlockServer function, OleUnlockServer must still be called, to decrement the lock count.
A server can terminate even though a client has called the OleLockServer function, if necessary.
OleUnlockServer