All Frameworks  Class Hierarchy  This Framework  Previous  Next  Index

Class System.IClassFactory

IClassFactory
 


public class IClassFactory

Interface to component factories.
Role: Objects that implement IClassFactory instantiate components using their CLSIDs as input, and return to the client a pointer to the requested interface.


Method Index


o CreateInstance
Creates an uninitialized component of a given CLSID.
o LockServer
Keeps an out-process server in memory.

Methods


o CreateInstance
  public HRESULT __stdcall CreateInstance(IUnknown * iUnkOuter,
                                          REFIID     iIid,
                                          void    ** oObject )=0
Creates an uninitialized object of a specified CLSID. Objects that implement IClassFactory instantiate components using their CLSIDs as input, and retrieve a pointer to the requested interface passed as an output argument to the client.
Parameters:
iUnkOuter
A pointer to the aggregating component IUnknown interface.
Legal values: NULL if the client is not an aggregating component, and a pointer to its IUnknwon interface otherwise.
iIid
A reference to the identifier to an interface that the component implements and for which the client request a pointer to be retrieved.
Legal values: Should be expressed as IID_CATIXX, where CATIXX is the interface to which a pointer is requested
oObject
The address of the pointer to the requested interface
Returns:
An HRESULT value.
Legal values:
S_OK
The component is successfully created and the interface pointer is successfully returned
E_FAIL
The component was successfully created, but the interface query failed
E_NOINTERFACE
The component was successfully created, but the it doesn't implement the requested interface
E_OUTOFMEMORY
The component allocation failed
o LockServer
  public HRESULT __stdcall LockServer(BOOL iLock )=0
Keeps an out-process server in memory.
Parameters:
iLock
Locking flag.
Legal values: TRUE to keep the server in memory, and FALSE otherwise
Returns:
An HRESULT value.
Legal values:
S_OK
The server is successfully locked or unlocked
E_FAIL
The server cannot be accessed