System.Win.ComServ.DllGetClassObject

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function DllGetClassObject(const CLSID, IID: TGUID; var Obj): HResult;

Properties

Type Visibility Source Unit Parent
function public System.Win.ComServ.pas System.Win.ComServ System.Win.ComServ

Description

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

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.

See Also