IPersist::GetClassID

Returns the class identifier (CLSID) the component object. The CLSID is a unique value that identifies the application that can manipulate the component object data.

HRESULT GetClassID(

CLSID *pClassID
//Pointer to CLSID of component object
);

Parameter

pClassID

[out]Points to the location where the CLSID is returned. The CLSID is a globally unique identifier (GUID) that uniquely represents an object class.

Return Values

S_OK

The CLSID was successfully returned.

E_FAIL

The CLSID could not be returned.

Comments

This method returns the class identifier (CLSID) for an object, used in later operations to load object-specific code into the caller's context.

Notes to Callers

Most container applications have no need to call the IPersist::GetClassID method directly. A container application might use this method when the container needs to change the CLSID and save the new CLSID for the component object. For example, if the container is treating a component as a different class and an editing operation occurs so that the component object can no longer be edited by its original application. In this case, the container needs to change the CLSID for the component. Typically, in this case, the container calls the OleSave helper function which performs all the necessary steps.

The exception would be a container that provides an object handler for certain component objects. In particular, a container application should not get a component object CLSID and then use it to retrieve class specific information from the registry. Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly from the object.

Notes to Implementors

Typically, a component object simply returns a constant CLSID in its implementation of this method. This is not the case, however, if your component object supports "Treat As" operations in which it edits other classes of components as if they were its own class. If your object is running a component of another class, your implementation of IPersist::GetClassID must return the CLSID stored in the component storage.

The implementation of IPersist::GetClassID in the default object handler passes the call to the implementation in the component object if the component object is running. Otherwise, the default handler calls the ReadClassStg function to read the CLSID that is saved in the component object storage.

If you are writing a custom object handler for your component, you might want to simply delegate this method to the default handler implementation (see OleCreateDefaultHandler).

See Also

IDataObject::EnumFormatEtc, IOleObject::EnumVerbs, IOleObject::GetMiscStatus, IOleObject::GetUserType, OleCreateDefaultHandler, ReadClassStg

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database