Hello Monks!
I'm currently trying to translate some code from VB to perl. I've come across a problem accessing the non default interface of the application id. It's one single line in VB that I simply haven't found any way to deal with in Perl.
In Application id FOO in Itypelib Viewer: Note that the ImyWantedInterface is declared hidden but also with oleautomation.
coclass myCoclass { [default] interface ImyCoclass; interface ImyWantedinteface; [default, source] dispinterface IOtherEvents; };

VB code snippet
ConnectToServer(myCo, "FOO.myCoClass") Dim myCoInternal As FOO.imyWantedinterface Set myCoInternal = myCo ' now myCoInternal can access ImyWantedinterface's methods myCoInternal.doit ' Works
Perl
use Win32::OLE my $myCo = Win32::OLE->new('FOO.myCoClass') or die "Cannot create obje +ct"; # Works without problems my $myCoInt = Win32::OLE->new('FOO.ImyWantedinteface') or die "Cannot + create object"; # Gives invalid class string # Also given method doit is in the ImyWantedinterface's declaration $myCo->doit(); # Fails
Is there anyway of choosing the interface which I want to query within the object? I have searched loads for a solution but I have not found any answers. I'm no expert on COM and the declarations but it seems to me this is an unusual way to actually declare the COM interface and therefore it might not be implemented in the Win32::OLE?
Any help or suggestions are welcomed!
Boniek

In reply to Choosing non-default COM interface in Win32::OLE by Boniek

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.