RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComObjectFactory.RegisterClassObject Method

Registers the COM class associated with the factory object.

Pascal
procedure RegisterClassObject;
C++
__fastcall RegisterClassObject();

RegisterClassObject registers an EXE class object with OLE so other applications can connect to it. EXE object applications should call RegisterClassObject on startup. It can also be used to register internal objects for use by the same EXE or other code (such as DLLs) that the EXE uses. 

If RegisterClassObject is not successful, an EOleSysError is raised with the following error code possibilities:

Value 
Meaning 
E_INVALIDARG  
One or more the arguments are invalid.  
E_OUTOFMEMORY  
Not enough memory.  
An unexpected error occurred.  
CO_E_OBJISREG  
The class was already registered in the class object table.  

Only EXE object applications call RegisterClassObject. Object handlers or DLL object applications do not call this function. Instead, they must implement and export the DllGetClassObject function. 

At startup, a multiple-use EXE object application must create a class object (with the IClassFactory interface on it), and call RegisterClassObject to register the class object. Object applications that support several different classes (such as multiple types of embeddable objects) must allocate and register a different class object for each. 

Multiple registrations of the same class object are independent and do not produce an error. Each subsequent registration yields a unique key. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!