in reply to Getting a Variant Array From a Win32 DLL Function

You need to use Win32::OLE::Variant module.
Variants are the variable datatype between OLE functions which are a generic type which needs to be casted.
You will need to use Dim() and Get(DIM) to get the elements and need to convert them according to their types to use them.
  • Comment on Re: Getting a Variant Array From a Win32 DLL Function

Replies are listed 'Best First'.
Re^2: Getting a Variant Array From a Win32 DLL Function
by Jim (Curate) on Oct 29, 2007 at 19:32 UTC
    Thank you for your reply.

    I had stumbled upon Win32::OLE::Variant, but I was and still am confounded by it and by its relationship to Win32::API.

    I have a DLL, but I don't know that it's an "OLE server". Can I use Win32::OLE::Variant in tandem with Win32::API? If so, how?

    Here's the documentation of Win32::OLE::Variant->Dim():

    Returns a list of array bounds for a VT_ARRAY variant. The list contains an array reference for each dimension of the variant's SAFEARRAY. This reference points to an array containing the lower and upper bounds for this dimension.

    Working backwards from that, which I don't grok, into a working Perl script seems daunting. Is it hopeless?

    I confess I thought using Perl to do a tad bit of Windows programming was going to be easier.

    Jim