Solved

[Type libraries] Getting the name of an Interface Identification...

Posted on 2003-10-29
3
617 Views
Last Modified: 2008-02-01
I have a type library. The type library has a method that returns an IID of another COM class. I now need to know which class this IID belongs to.

Okay, first answer: use StringFromIID()... Well, wrong since this just returns me the GUID as a string.
Second answer: use ProgIDFromCLSID()... Wrong again since this method requires a CLSID, not an IID. The difference? CLSID's are registered in the registry...
Thirs answer: just maintain a list of possible GUID's in the type library and do a lookup of each GUID in an internal table. Okay, this works but it's not a good solution.

In other words, I need a better solution...

For those of you who use the ADO type library, one of the COM IID's that I try to convert to some readable text is IID__Recordset {00000555-0000-0010-8000-00AA006D2EA4} but the system will not provide me the proper name for this GUID. I know it is possible since Delphi can do this when it opens a type library. So what am I missing here???

I guess I'm missing the link to related type libraries. In other words, the dependency list of the type library... Guess I have to load the dependencies and then look into these type libraries to translate the IID correctly...
0
Comment
Question by:Wim ten Brink
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
velter earned 250 total points
ID: 9661141
You need to open the type lib and find the interface in it

Example to read the IID__Recordset Description

1 - Read the regsitry key HKCR\Interface\{00000555-0000-0010-8000-00AA006D2EA4}\TypeLib
This will give you the GUID of the typelib : {00000300-0000-0010-8000-00AA006D2EA4}

1 - Read the regsitry key HKCR\Interface\{00000555-0000-0010-8000-00AA006D2EA4}\TypeLib\Version
This will give you the version of the typelib : 2.5

2 - Read the registry key HKCR\TypeLib\{00000300-0000-0010-8000-00AA006D2EA4}\2.5\0\win32
This will give you the path of the type lib : C:\Program Files\Fichiers communs\System\ado\msador15.dll (for my system, might be different on yours)

3 - Load the typelib
LoadTypeLib('C:\Program Files\Fichiers communs\System\ado\msador15.dll',oTypeLib)

4 - Get the type info
oTypeLib.GetTypeInfoOfGuid(StringToGUID('{00000555-0000-0010-8000-00AA006D2EA4}',oTypeInfo)

4 - Get the name / doc string / help
oTypeInfo.GetDocumentation(MEMBERID_NIL,oName,oDocString,oHelpContext,oHelpFile);
0
 
LVL 17

Author Comment

by:Wim ten Brink
ID: 9758712
Ewwwwwwww... I dislike that solution because I need to look into the registry. I am quite familiar with the registry, therefore I try to avoid using it as much as possible. It works but wonder if there's a non-registry solution too. So I keep this question open for a while and if someone provides a non-registry solution in the next two weeks, I'll double the points and split them between you and the other answer.
0
 
LVL 17

Author Comment

by:Wim ten Brink
ID: 9896054
It seems to work okay and no one else could provide a better solution so, points to velter.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now