On Sun, 05 Jun 2005, J aperlh wrote: > A question about Win32::OLE. Really need you help!!!
Still not a good reason to double post your question all over the place... [...] > But, for the following function, I don't know that I should pass to > this funtion. > Array reference or something else? > > # BOOL GetValues(BSTR* names, double* values, short number_of_names); > > # (input) > # names: a list of names > # number_of_names: size of the array > # (output) > # values: a list of corresponding values, > > > I tried to pass array references to it, and something else, like the > following, > both failed with an error: Type Mismatch... This really depends on how the corresponding IDispatch function is implemented, but assuming the [in] and [out] properties are reflected correctly I would assume something like: > my $names = Variant(VT_BSTR|VT_ARRAY, 3); This should not really be needed; you should be able to pass in an array ref. > my $values = Variant(VT_R8|VT_ARRAY, 3); This would be missing a VT_BYREF option to make sure the result is marshaled back to you: my $values = Variant(VT_R8|VT_ARRAY|VT_BYREF, 3); > $names->Put( ['name1', 'name2', 'name3'] ); > $values->Put( [0, 0, 0] ) > > my $ret = GetValues($names, $values, 3); my $ret = $app->GetValues([qw(name1 name2 name3], $values, 3); Of course the implementer of your $app should have provided a nicer automation interface since the number_of_names argument is redundant. All SAFEARRAYs already contain their number of elements. Cheers, -Jan _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs