Locks an object application open in memory. This enables instances to be created more quickly.
HRESULT LockServer( BOOL fLock );
If TRUE, increments the lock count; if FALSE, decrements the lock count.
This method can return the standard return values E_OUTOFMEMORY, E_UNEXPECTED, E_FAIL, and S_OK.
IClassFactory::LockServer controls whether an object's server is kept in memory. Keeping the application alive in memory allows instances to be created more quickly.CoLockObjectExternal function.
The process that locks the object application is responsible for unlocking it. After the class object is released, there is no mechanism that guarantees the caller connection to the same class later (as in the case where a class object is registered as single-use). It is important to count all calls, not just the last one, to LockServer, because calls must be balanced before attempting to release the pointer to the IClassFactory interface on the class object or an error results. For every call to LockServer with fLock set to TRUE, there must be a call to LockServer with fLock set to FALSE. When the lock count and the class object reference count are both zero, the class object can be freed.
|Minimum supported client||Windows 2000 Professional [desktop apps | UWP apps]|
|Minimum supported server||Windows 2000 Server [desktop apps | UWP apps]|
|Header||unknwnbase.h (include Unknwn.h)|