TypeLib Explorer [Windows COM Stuff]

Developed or developing a new product in PureBasic? Tell the world about it.
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

TypeLib Explorer [Windows COM Stuff]

Post by RE-A »

When I was using the other well-known PB compiler on the net, it had a nice tool created by someone from that community, that was able to enumerated all typelibs available on your system, included with all guids, progids, events, enumeration, structures, interfaces, comments, property names, types, ect….

If you program a lot of COM then this is (I hope) a good reference and code generator tool.

Make sure that you have an administrator account and that the TBLINF32.DLL is installed on your system.

Most of the generated code will compile fine but it is possible that some errors occur about the order of the interfaces or double creation of enumeration fields.

Maybe the next version could include procedures and some event handling routines.

Tested on Vista and WinXP (32 bit)

Download: http://www.re-applications.be/downloads ... plorer.exe

Have fun.
[edit title by Rings]
Last edited by RE-A on Sun Aug 01, 2010 5:47 am, edited 1 time in total.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: TypeLib Explorer

Post by netmaestro »

Thanks for sharing, looks like it might be very useful. However, when I select one of the controls and press 'Create PB Code' the item becomes unselected and nothing happens. No code gets generated.
BERESHEIT
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: TypeLib Explorer

Post by Josh »

@netmaestro
i have no problems. works fine

@RE-A
thxs, looks very nice

what i see at my first quickcheck:
you create interfacecodes for interfaces and dispinterfaces. if i'm writing a application using earl binding, i need only the interfaces, but no dispinterfaces. so i think, you can reduce the generated code nearly to the half.
sorry for my bad english
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

Re: TypeLib Explorer

Post by RE-A »

netmaestro, I already made a minor bug fix so get the latest version (V1.1)
If that doesn't work, can you tell me what control it is?
Some of them take some time to process :?

Josh, I know, some generated source could be very big so just take what you need :wink:
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: TypeLib Explorer

Post by netmaestro »

It's all the controls. If I select one and press the Create button it unselects the item and nothing happens. I waited a minute or two but no code appears. I'm using Windows 7.
BERESHEIT
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: TypeLib Explorer

Post by Josh »

RE-A wrote:Josh, I know, some generated source could be very big so just take what you need :wink:
maybe i'm wrong, but i don't see any possibility, dispinterfaces are needed. compare this interface and dispinterface:

Code: Select all

   Interface ExcelIVPageBreak Extends IDispatch
    get_Application(a)
    ; a BYREF RHS INTEGER coclass Application
    get_Creator(a)
    ; a BYREF RHS INTEGER enum XlCreator
    get_Parent(a)
    ; a BYREF RHS INTEGER coclass Worksheet
    Delete()
    DragOff(a, b)
    ; a BYVAL Direction INTEGER enum XlDirection
    ; b BYVAL RegionIndex LONG (#VT_I4)
    get_Type(a)
    ; a BYREF RHS INTEGER enum XlPageBreak
    put_Type(a)
    ; a BYVAL RHS INTEGER enum XlPageBreak
    get_Extent(a)
    ; a BYREF RHS INTEGER enum XlPageBreakExtent
    get_Location(a)
    ; a BYREF RHS INTEGER dispinterface ExcelRange
    putref_Location(a)
    ; a BYREF RHS INTEGER dispinterface ExcelRange
  EndInterface
  
  Interface ExcelVPageBreak Extends IDispatch
    get_Application()
    get_Creator()
    get_Parent()
    Delete()
    DragOff(a, b)
    ;a [IN] BYVAL Direction INTEGER enum XlDirection
    ;b [IN] BYVAL RegionIndex LONG (#VT_I4)
    get_Type()
    put_Type()
    get_Extent()
    get_Location()
    putref_Location()
  EndInterface
i know, if the code for dispinterfaces is included, it's no difference for the exe. but when i'm looking at the generated code from excel, i have 35k lines and it can be confusing to find the correct interface. it's not guaranteed, that each interface has an "I" as prefix.
sorry for my bad english
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

Re: TypeLib Explorer

Post by RE-A »

Could be a Win7 issue, I couldn't test it on a Win7 or 64 bit system because the only one have isn't available and I hope I won't get it soon... it’s paying itself back, running as a backup server with a customer 8)

Josh, I give it a look.
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

Re: TypeLib Explorer

Post by RE-A »

Josh, to make a difference between an interface and a dispinterface I made a change in the interface header comment block.

Example:
; --------------------------------------------------------------------------------------------
; NAME: VPageBreak
; GUID: {00024402-0000-0000-C000-000000000046}
; TYPE: DISPINTERFACE
; --------------------------------------------------------------------------------------------

That should do it for now, a selection or option window could be useful, maybe when I find more time.

New version: 1.2
User avatar
Kiffi
Addict
Addict
Posts: 1357
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: TypeLib Explorer

Post by Kiffi »

@RE-A: Thanks a lot for this useful tool! Image

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: TypeLib Explorer

Post by srod »

Okay, where can I get a copy of TBLINF32.DLL ? :)

I don't want to install VS.NET just to get my hands on this dll.
I may look like a mule, but I'm not a complete ass.
User avatar
Kiffi
Addict
Addict
Posts: 1357
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: TypeLib Explorer

Post by Kiffi »

TLBINF32.DLL, not TBLINF32.DLL

TLB stands for TypeLiB.
srod wrote:Okay, where can I get a copy of TBLINF32.DLL ? :)
i guess in your System32-Folder. ;-)

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: TypeLib Explorer

Post by srod »

Yes, just a typo.

Right, I'll have a rummage around. :)

**EDIT : have searched the whole drive and I do not possess that dll.
I may look like a mule, but I'm not a complete ass.
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

Re: TypeLib Explorer

Post by RE-A »

srod, this dll it part of VB6.... I know you definitely don't want to install that :D but you can find it on the net, just google for it.
RE-A
User
User
Posts: 39
Joined: Thu Aug 21, 2008 4:19 pm
Location: Belgium
Contact:

Re: TypeLib Explorer

Post by RE-A »

Minor change, all referenced interfaces that does not exist in the typelib are changed to IUnknown.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: TypeLib Explorer

Post by srod »

RE-A wrote:srod, this dll it part of VB6.... I know you definitely don't want to install that :D but you can find it on the net, just google for it.
Yes I have done, but can find no 'reputable' looking site offering this dll. I am not about to download what purports to being tlbinf32.dll from some dodgy looking site - no sir! :)
I may look like a mule, but I'm not a complete ass.
Post Reply