I need to pass an empty Array of Variants to a DLL written in C (and available on all Windows versions), and the C code (which I have no control over and cannot edit) will populate the Empty Array of Variants with its some return values.
Bascially, when I try this - the ByRef Array is always empty when it should contain the results of the function/sub call (if I do the exact same thing in .NET, it works).
I'm thinking I need to do a custom declaration so VB knows how to call the C function, or?
Here is how the C sub/function is declared. Given this, what do I need to do in order to ensure C is able to use my Empty Array properly and I in tern get my results back?
HRESULT InvokeAction(
[in] BSTR bstrActionName,
[in] VARIANT varInActionArgs,
[in, out] VARIANT *pvarOutActionArgs,
[in, out] VARIANT *pvarRetVal
);
More information about this function: http://msdn.microsoft.com/en-us/library/aa382237(VS.85).aspx
Thanks
From http://msdn.microsoft.com/en-us/library/aa381230(VS.85).aspx:
Dim returnVal
Dim outArgs(1)
Dim args(1)
args(0) = 3
returnVal = service.InvokeAction("GetTrackInfo", args, outArgs)
'return Val now contains the track length
'and outArgs(0) contains the track title
Dim emptyArgs(0)
returnVal = service.InvokeAction("Play", emptyArgs, emptyArgs)
'returnVal indicates if the action was successful
Just how you get and instance of service is not clear from this example though.