Question Interoperability issue between VC++ (ocx) & VB.NET applications

RevatiDOtNet

New member
Joined
Jan 21, 2016
Messages
1
Programming Experience
1-3
Hello,


We are migrating a product from VB6 to VB.NET and facing an issue.
This product interacts with a function defined in VC++ component (.ocx).


1. VB6 & VB.NET function call:


result = TestFunc(Param1, Param2, Param3)


2. VC++:
a) Function definition in .CPP file:
long TestFunc(long FAR* Param1, const VARIANT FAR& Param2, long Param3)
{
...
}
DISP_FUNCTION(Ctrl, "TestFunc", TestFunc, VT_I4, VTS_PI4 VTS_VARIANT VTS_I4)

b) Function signature in .ODL file:
long TestFunc(long* Param1, VARIANT Param2, long Param3);


c) Function signature in .h(header) file:
afx_msg long TestFunc(long FAR* Param1, const VARIANT FAR& Param2, long Param3);



"Param2" in above "TestFunc" is defined as byte array in VB6 & VB.NET.


In VC++, the corresponding type for "Param2" in "TestFunc" is - "const VARIANT FAR& Param2".


In VB6, the byte array values passed gets modified in VC++ "TestFunc" & the modified values are received in VB6 "Param2" variable.


Issue in VB.NET:


In VB.NET, the byte array values passed gets modified in VC++ "TestFunc".
However, the modified values are not transferred from VC++ to VB.NET. The "Param2" variable still has the original values & not the modified values.


Could you please provide us information on how to obtain the modified byte array values in VB.NET from the Variant variable in VC++ component?


Thanks in advance.
 
Last edited:
Back
Top