|
-
February 16th, 2000, 11:38 PM
#1
Trouble passing VARIANT array to method
I am trying to pass a VARIANT array of strings from a VB class to a method in a control written in C++. At run time I get a runtime error 5, invalid procedure call or argument. The method is present, and the .dll containing it is the only one registered (or present at all) on the machine. It shows up in the object browser too. Any help on this would be appreciated.
My method is declared in C++ as follows:
.idl
[id(1), helpstring("method MyMethod")] HRESULT MyMethod([in]VARIANT Filenames, [out, retval]long * result);
.h
STDMETHOD(MyMethod)(/*[in]*/VARIANT Filenames, /*[out, retval]*/long * result);
And I access it as follows in VB:
Dim oMyObject as new MyObject
Dim szStrings() As String
Dim vArray as Variant
Dim lReturn as Long
ReDim szStrings(3)
szStrings(0) = "One"
szStrings(1) = "Two"
szStrings(2) = "Three"
vArray = szStrings()
'And here I get an error
lReturn = oMyObject.MyMethod(vArray)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|