Purveyors of Perl Wisdom,

I'm trying to access a Win32 DLL using the Win32 OLE module. Some test code is shown below.

#!/usr/bin/perl -w #xcalibur automation test script use strict; use Win32::OLE; use Win32::OLE::Const 'XRawfile2 1.0 Type Library'; #specify a data file and create the object my $rawFile = 'C:\Xcalibur\Data\oligo01.raw'; my $XRawfile = new Win32::OLE('Xrawfile.XRawfile.1') or die "yikes, ca +n't instantiate object\n"; #read back the object my $obj = Win32::OLE->QueryObjectType($XRawfile); #this line returns "IXRawfile", everything appears ok print "object type = $obj\n"; #open a file into the XRawfile object $XRawfile->Open("$rawFile"); #this line seems to indicate everything is ok as it doesn't return an +error test_for_error(); #try to readback the file we just loaded #alas this appears to suck pond water - doesn't work my $filename = ""; $XRawfile->GetFileName($filename); test_for_error(); print "the file is: $filename\n"; #sub that prints an error if encountered sub test_for_error { my $error = Win32::OLE->LastError(); print $error if $error; }

Basically, it looks like I can create the object ok (line 15). I also think that I'm opening the rawfile ok (line 23), since no errors are returned. I can't seem to get the other methods to work. I think, the problem is that the other methods associated with this DLL require the variables to be pointers. For example, the GetFileName method that I've attempted to implement above actually appears to require a pointer to a string. For example, the function call from the OLEview for the GetFileName method is:

void GetFileName(BSTR* pbstrFileName);

Is there a way to implement these calls with Win32::OLE, or do I need to use the Win32::API or Win32::API::Prototype? Some of the other methods require pointers to longs, doubles, or variants. Any thoughts (or pointers) would be greatly appreciated.

Regards,
chinman


In reply to "pointers" for calling a DLL by chinman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.