Link to home
Start Free TrialLog in
Avatar of jonnyfive
jonnyfive

asked on

Exploring a type library...

Hi everyone...

I want to write a tool, which can examine a COM objects type library and display it's methods, propertys and needed parameters. How would I start with that? Is there any API function to retrieve this information? IDispatch doesn't seem to useful to me.

Regards, Jonny...
Avatar of rwilson032697
rwilson032697

Well, you already have one!

When Delphi imports a type library it constructs a .TLB file, basically an interface unit describing all the interfaces, methods and parameters etc.

If you then open that _TLB.Pas file you will be able to use the explorer view to do what you want.

If you already knew this and want to write a new tool to do this from scratch ignore this comment :-)

Cheers,

Raymond.
Im presuming you want to explore third part OCX's without access to the TLB file that Delphi generates.

I wrote a routine to get the classname, interfaces, and guids out of any library. I cant remember the exact implementation, i'll post it on monday.

In the meantime, i recall that it involved using the ITypeInfo interface, and the PTypeAttr type, and calling GetDocumentation. There are other methods to explore interfaces and enums.
I maybe even used ITypeLib, not sure if it exists.






ASKER CERTIFIED SOLUTION
Avatar of ShadowFax
ShadowFax

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You did NOT write this.

Its ripped from the Delphi COM Programming book (Eric Harmon).
Avatar of jonnyfive

ASKER

Well, I suppose I will accept this answer. I just bought the "Delphi COM Programming" book my self and find it very useful. Since Gavin just copy-pasted existing code (leave alone claiming it as his own) without any further explaination or comments, I will rate this with D.

Regards, Jonny
I suppose the fact that I typed the whole app out from the book deserves no commendation yet makes it my own.

:-) I just say one thing: www.newriders.com/delphi

Have fun... Jonny...
HEH.

Nice try Shadow :-)