Skip to content

Latest commit

 

History

History
78 lines (63 loc) · 3.87 KB

nf-unknwn-iclassfactory-lockserver.md

File metadata and controls

78 lines (63 loc) · 3.87 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:unknwn.IClassFactory.LockServer
IClassFactory::LockServer
The IClassFactory::LockServer method locks an object application open in memory. This enables instances to be created more quickly.
IClassFactory interface [COM]
LockServer method
IClassFactory.LockServer
IClassFactory::LockServer
LockServer
LockServer method [COM]
LockServer method [COM]
IClassFactory interface
_com_iclassfactory_lockserver
com.iclassfactory_lockserver
unknwnbase/IClassFactory::LockServer
com\iclassfactory_lockserver.htm
com
4c817b89-013d-477f-a713-5e320896dfa0
08/15/2022
IClassFactory interface [COM],LockServer method, IClassFactory.LockServer, IClassFactory::LockServer, LockServer, LockServer method [COM], LockServer method [COM],IClassFactory interface, _com_iclassfactory_lockserver, com.iclassfactory_lockserver, unknwnbase/IClassFactory::LockServer
unknwn.h
Unknwn.h
Windows
Windows 2000 Professional [desktop apps \| UWP apps]
Windows 2000 Server [desktop apps \| UWP apps]
Unknwn.idl
Windows
19H1
IClassFactory::LockServer
unknwn/IClassFactory::LockServer
c++
APIRef
kbSyntax
COM
unknwnbase.h
IClassFactory.LockServer

-description

Locks an object application open in memory. This enables instances to be created more quickly.

-parameters

-param fLock [in]

If TRUE, increments the lock count; if FALSE, decrements the lock count.

-returns

This method can return the standard return values E_OUTOFMEMORY, E_UNEXPECTED, E_FAIL, and S_OK.

-remarks

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.

Notes to Callers

Most clients do not need to call this method. 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. One way to implement LockServer is to call the 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.

-see-also

CoLockObjectExternal

IClassFactory