Solved

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

Posted on 2003-10-29
3
615 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

18 Experts available now in Live!

Get 1:1 Help Now