OleLockServer

3.1

  #include <ole.h>    

  OLESTATUS OleLockServer(lpObject, lphServer)    
  LPOLEOBJECT lpObject; /* address of object */
  LHSERVER FAR* lphServer; /* address of 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.

Parameters

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 object can be deleted.

lphServer

Points to the handle of the server application when the function returns.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which may be one of the following:

OLE_ERROR_COMM
OLE_ERROR_LAUNCH
OLE_ERROR_OBJECT

Comments

A client calls OleLockServer 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 OleUnlockServer 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.

If necessary, a server can terminate even though a client has called the OleLockServer function.

See Also

OleUnlockServer