A Microsoft COM server that provides TypeLib information is distributed in the 
file named tlbinf32.dll.  It is included in various development environments 
and is available in an installer at
http://www.lambdasoft.dk/comet/../files/tlbinf32.exe

A help file in CHM format is available at the web page
http://support.microsoft.com/kb/224331/en-us/

I have a current version of Perl for Windows from ActiveState.com, and would 
like to make use of the tlbinf32 library in some scripts.  After spending hours 
trying to instantiate the "TLI.TLIApplication" object without success, I joined 
this list in search of help.  I have been able to create the COM object and 
invoke its methods with other languages, including VBScript, WinBatch, and 
AutoIt -- though not with Ruby either (and Google searches inform me that PHP 
and Python also have difficulty with this).  My Perl script, pasted below, 
produces the following error message:

Win32::OLE(0.1703) error 0x80004002: "No such interface supported" at tlbinf.pl
line 8.

As the commented lines below indicate, I have tried initializing the OLE system 
with the single threaded or   co-initialize constant instead, but get the same 
result.  I also get the same result if I use the CLSID string from the Windows 
registry, rather than the ProgID.

I would appreciate any suggestions.  Although I have studied Perl tutorials 
extensively, I am still relatively new to the language, so please be gentle 
about any stylistic or other problems in the current version of my script below.

Regards,
Jamal
Content of [tlb.inf.pl -- a script to enumerate the methods of an object]

use strict;
use warnings;
use Win32::OLE;

Win32::OLE->Uninitialize();
Win32::OLE->Initialize(Win32::OLE::COINIT_APARTMENTTHREADED);
#Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
my $oApp = Win32::OLE->new('TLI.TLIApplication') or 
die(Win32::OLE->LastError());
#my $oApp = Win32::OLE->new('{8B21775E-717D-11CE-AB5B-D41203C10000}') or 
die(Win32::OLE->LastError());

my $oFSO = Win32::OLE->new('Scripting.FileSystemObject') or die("can't create 
FSO");
my $oRef = $oApp->InterfaceInfoFromObject($oFSO);
my $sList = '';
my $oMembers = $oRef->{Members};
my $iCount = $oMembers->{Count};
my $i = 1;
while ($i <= $iCount) {
    my $oItem = $oMembers->Item($i);
    my $sName = $oItem->{Name};
    $sList += $sName . "\r\n";
    $i ++;
}
print $sList;


[For comparison, here is tlbinf.au3, a working AutoIt version]

$oApp = ObjCreate("TLI.TLIApplication")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$oRef = $oApp.InterfaceInfoFromObject($oFSO)
$s = ""
$iCount = $oRef.Members.Count
$i = 1
while $i <= $iCount
    $s = $s & $oRef.Members.Item($i).Name & @CrLf
    $i += 1
Wend
MsgBox(0, $s, "")
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to