CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    1,435

    GUIDs from ITypeLib

    I have created a project with automation classes and - along with the executable - a type library is generated. Next, I use the ITypeLib interface to get information from the library. The library contains just about everything I would want to know about the class objects in the project but I haven't been able to get GUIDs of the objects.

    For example, I create a CAutoObject and it is assigned a GUID for the IDispatch and one for the coclass. I build my project and then create an ITypeLib interface. From that interface I can get information about methods, properties, parameters, etc. but I have been unable to determine how to get the GUIDs or ICAutoObject.

    Any ideas?

  2. #2
    Join Date
    Feb 2003
    Location
    California
    Posts
    334

    Re: GUIDs from ITypeLib

    I seem to recall having encountered the same frustration and concluded it wasn't possible. Let me know if you find a way.
    Henri Hein
    Principal Engineer, Propel
    Do not credit Propel with my views or opinions.

  3. #3
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930

    Re: GUIDs from ITypeLib

    Quote Originally Posted by 0xC0000005
    I have created a project with automation classes and - along with the executable - a type library is generated. Next, I use the ITypeLib interface to get information from the library. The library contains just about everything I would want to know about the class objects in the project but I haven't been able to get GUIDs of the objects.

    For example, I create a CAutoObject and it is assigned a GUID for the IDispatch and one for the coclass. I build my project and then create an ITypeLib interface. From that interface I can get information about methods, properties, parameters, etc. but I have been unable to determine how to get the GUIDs or ICAutoObject.

    Any ideas?
    You can obtain the GUID from ITypeInfo interface ("GetTypeAttr" method) and TYPEATTR structure ("guid" field). You can look at source of AtlGetObjectSourceInterface to get the technique.

    About ICAutoObject (if I understand clearly):

    ITypeInfo::GetRefTypeOfImplType

    HRESULT GetRefTypeOfImplType(unsigned int index, HREFTYPE* pRefType);

    Comments
    If the TKIND_DISPATCH type description is for a dual interface, the TKIND_INTERFACE type description can be obtained by calling GetRefTypeOfImplType with an index of –1, and by passing the returned pRefType handle to GetRefTypeInfo to retrieve the type information.
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured