OxPM: FW: Perl and COM
Ronald Mundell
Mundell at yebo.co.za
Tue Oct 15 12:57:15 CDT 2002
Good Day
I got your information from PM. If you could help me I would appreciate it!
I am trying to access a Com DLL using Perl. The DLL was written in Visual
Basic and return a "ByRef szData as String" Variable. When I pass Data to
it, it receives the data and works. The problem is when retrieving data back
from this DLL. The Visual Basic String is equal to BSTR under Visual C. I
need to return Data back from the DLL. If anybody know how to solve this I
would appreciate it
use strict;
use Win32::OLE;
use Text::ParseWords;
Win32::OLE->Initialize ( Win32::OLE::COINIT_OLEINITIALIZE );
my $ReaderList;
my @Readers;
my $Reader;
my $Data;
my $ucData;
my $card;
my $Error;
my $count;
my $iRet = -1;
my $iLen;
my $pReader = \$Reader;
my $pData = \$ucData;
my $pError = \$Error;
my $filename;
$card = Win32::OLE->new ( "MSCard.SomeCard" ) or die "Oops!!\n";
$ReaderList = $card->GetCardReaderList( $pError );
@Readers = "ewords(',', 0, $ReaderList);
foreach $Reader( @Readers )
{
$iRet = $card->ConnectToCard ( 0, $pReader, $pError );
if ( $iRet == 0 )
{
last;
}
}
if ( $iRet == 0 )
{
$filename = "/SerialNo";
$iLen = $card->GetFileLen($filename, $pError);
print "File Length: $iLen\n";
if ( $iLen < 0 )
{
print "Error $Error\n";
}
$iRet = $card->GetSerialNo( $pData, $pError);
}
print "Card: $card\n";
print "ReaderList: $ReaderList\n";
print "Reader: $Reader\n";
print "Error: $Error\n";
printf "iRet: %d\n", $iRet;
print "Data: $Data\n";
Ronald Mundell
EMAIL: RonaldMu at Nedcor.com
105 West Street
Ground Floor
B-Block
Room: BG3
Phone: 881-3751(Office)
083 411 1107(Mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/oxford-pm/attachments/20021015/d7b8576a/attachment.htm
More information about the Oxford-pm
mailing list