Solved

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

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

810 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