mikewhit_ has asked for the wisdom of the Perl Monks concerning the following question:

Simple COM methods (none or single arg) seem to work OK, but get error message
Win32::OLE(0.1601) error 0x80020005: "Type mismatch" in METHOD/PROPERTYGET "FlashLamp" argument 1 at CS1.pm line 199

when calling interface method with (in my case) three args; callable OK from VB.

Is this a Win32::OLE calling issue with multiple args, or do I need to look elsewhere?

Perl code:
$cs1 = Win32::OLE->GetActiveObject("CS.CSInterface1") or die "Coul +d not get interface CS1\n"; ... my ($on, $off, $count) = $_; # contains args !!! SHOULD USE ARRAY +HERE !!! $cs1->FlashLamp($on, $off, $count);

IDL:
[id(24), helpstring("method FlashLamp")] HRESULT FlashLamp([in] long OnDuration, [in] long OffDuration, [in] long FlashCount);

C++ code:

STDMETHODIMP CCSInterface1::FlashLamp(long OnDuration, long OffDuratio +n, long FlashCount) { return S_OK; }
Platform stuff:
WinXP SP1, ActiveState Perl 5.8.0.804

Thanks.

Update
Thanks! I couldn't see the wood for the trees.
Doh! Shows my Perl is rusty from a couple of years of non-use !
Used some code from some earlier work where I'd had a ref to a list, so I'd have had to deref it first anyhow !

But used an array now instead and all is well.
Cheers.

Replies are listed 'Best First'.
Re: Type mismatch in Win32::OLE method call with multiple args
by VSarkiss (Monsignor) on Jan 13, 2005 at 16:52 UTC