Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This method locks an object application open in memory. This allows new objects to be created more quickly.
HRESUTL LockServer( BOOL fLock );
Parameters
Return Values
This method supports the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as S_OK, which indicates that the specified object was either locked ( fLock= TRUE) or unlocked from memory ( fLock= FALSE).
Remarks
IClassFactory::LockServercontrols whether an object's server is kept in memory. Keeping the application alive in memory allows instances to be created more quickly.
Notes to Callers
Most clients do not need to call this function. It is provided only for those clients that require special performance in creating multiple instances of their objects.
Notes to Implementers
If the lock count is zero, there are no more objects in use, and the application is not under user control, the server can be closed.
The process that locks the object application is responsible for unlocking it. Once 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 IClassFactory::LockServer, because calls must be balanced before attempting to release the pointer to the IClassFactoryinterface on the class object or an error results. For every call to LockServerwith fLockset to TRUE, there must be a call to LockServerwith fLockset to FALSE. When the lock count and the class object reference count are both zero, the class object can be freed.
Requirements
Runs On | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | Objbase.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also