C
Cybertof
Hello,
Is it possible to convert a VB6 Array of Struct
to
a C# Array Of Struct ?
The test context is a C# application calling a VB6 ActiveX DLL Function
using UDT (User Defined Type) and array of UDT.
***************************************
Example : (VB6AX is an ActiveX VB6 DLL)
***************************************
(VB6 Side)
Type VB6Struct
d1 as double
d2 as double
l1 as long
End Type
(C# Side)
struct CSharpStruct
{
double d1;
double d2;
double d3;
long l1;
}
private VB6AX.CTest AXInstance; // ActiveX Class Instance
AXInstance = new VB6AX.CTest(); // Instanciate vb6 class
AXInstance.VB6Struct myData = new AXInstance.VB6Struct();
AXInstance.FillStruct(ref myData);
// (FillStruct is a vb6 class method to fill the structure)
IT WORKS, BUT...IF I DO
CSharpStruct myData = new CSharpStruct();
AXInstance.FillStruct(ref myData);
I have a
'cannot convert from ref CSharpStruct to ref AXInstance.VB6Struct'.
How to convert the ActiveX DLL Struct to the C# managed struct ?
The end of the story is that I would like my VB6 ActiveX DLL to fill an
array of structure, called by the C# client.
The filled array of structure should be a 'managed' array of struct so I
do have fast access speed to its elements later on in the application.
-> How to convert/mashal a VB6 Array Of Struct to a C# Array of Struct
(the C# array should be definied as an array of managed struct and not
through the ActiveX unmanaged structure declaration)
VB6AX.VB6Struct[] array1 = null; // array of unmanaged VB6 Struct
CSharpStruct[] array2 = null; // array of C# managed Struct
// bot struct represents the same thg
-> How to convert a ref VB6AX.VB6Struct to a ref CSharpStruct ?
-> How to convert a ref VB6AX.VB6Struct[] to a ref CSharpStruct[] ?
Can you help ?
Thanks.
Is it possible to convert a VB6 Array of Struct
to
a C# Array Of Struct ?
The test context is a C# application calling a VB6 ActiveX DLL Function
using UDT (User Defined Type) and array of UDT.
***************************************
Example : (VB6AX is an ActiveX VB6 DLL)
***************************************
(VB6 Side)
Type VB6Struct
d1 as double
d2 as double
l1 as long
End Type
(C# Side)
struct CSharpStruct
{
double d1;
double d2;
double d3;
long l1;
}
private VB6AX.CTest AXInstance; // ActiveX Class Instance
AXInstance = new VB6AX.CTest(); // Instanciate vb6 class
AXInstance.VB6Struct myData = new AXInstance.VB6Struct();
AXInstance.FillStruct(ref myData);
// (FillStruct is a vb6 class method to fill the structure)
IT WORKS, BUT...IF I DO
CSharpStruct myData = new CSharpStruct();
AXInstance.FillStruct(ref myData);
I have a
'cannot convert from ref CSharpStruct to ref AXInstance.VB6Struct'.
How to convert the ActiveX DLL Struct to the C# managed struct ?
The end of the story is that I would like my VB6 ActiveX DLL to fill an
array of structure, called by the C# client.
The filled array of structure should be a 'managed' array of struct so I
do have fast access speed to its elements later on in the application.
-> How to convert/mashal a VB6 Array Of Struct to a C# Array of Struct
(the C# array should be definied as an array of managed struct and not
through the ActiveX unmanaged structure declaration)
VB6AX.VB6Struct[] array1 = null; // array of unmanaged VB6 Struct
CSharpStruct[] array2 = null; // array of C# managed Struct
// bot struct represents the same thg
-> How to convert a ref VB6AX.VB6Struct to a ref CSharpStruct ?
-> How to convert a ref VB6AX.VB6Struct[] to a ref CSharpStruct[] ?
Can you help ?
Thanks.