RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
ComServ.DllGetClassObject Function

Obtains a class factory for an ActiveX object when the ActiveX object resides in an in-process ActiveX server (DLL).

Pascal
function DllGetClassObject(const CLSID: TGUID; const IID: TGUID; var Obj): HResult; stdcall;
C++
__stdcall HRESULT DllGetClassObject(const TGUID CLSID, const TGUID IID,  Obj);

ComServ

Do not call DllGetClassObject directly. DllGetClassObject is exported by all ActiveX server DLLs, and it is called internally by the operating system. When a user calls CoGetClassObject (or CoCreateInstance, which internally calls CoGetClassObject) to obtain a class factory for an ActiveX object, the OLE engine loads the ActiveX server DLL into memory and calls its DllGetClassObject function. 

The parameters to DllGetClassObject are: 

CLSID is the class identifier for the ActiveX object to be created by the class factory. 

IID is the interface indentifier for the interface through which the caller will communicate with the class factory object to create instances of the object referenced by CLSID. This parameter is nearly always IID_IClassFactory or IID_IClassFactory2. 

Obj will hold a pointer to the resulting class factory interface upon successful completion of the function. If an error occurs, Obj will be set to nil. 

The return values for DLLGetClassObject are as follows:

Value 
Meaning 
S_OK  
The object was retrieved successfully.  
E_NOINTERFACE  
The object referenced by Obj doesn't support the interface passed in the IID parameter.  
CLASS_E_CLASSNOTAVAILABLE  
The DLL does not support the class type referenced by the CLSID parameter.  

Note: DllGetClassObject is one of four functions in the ComServ unit that every in-process server must export so that Windows can manage the server resources properly. The others are DllCanUnloadNow, DllRegisterServer, and DllUnregisterServer.
 

DllCanUnloadNow 

DllRegisterServer 

DllUnregisterServer 

TComClassManager 

Requirements for Transactional Objects

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!