Home   Index   About
Ultimate Pack


Custom Search
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


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun