07-12-2010 07:59 AM
Hello
I created a .NET wrapper for COM object that i want to use in my teststand sequence.
in the COM object i declared struct type and i want to use it to send parameters and receive data.
I want to use structs as parameters in the object's methods.
I'm using TesStand version 4.2.1
The only problem is that TesStand would not accept methods with structs as parameters.
(btw - The registration of the COM is ok I could activate it using native C code)
here is the message i get from teststand:
"the following members have parameter or return values that are not competible with TestStand and are not available from the activex adapter: method test2 parameter TS"
pls tell me how to use struct in activeX adapter.
Here is a test version of the COM Object:
[StructLayout(LayoutKind.Sequential)]
[Guid("CBAAE192-FBCF-4820-BCCB-6503B0739563")]
[ComVisible(true)]
public struct TetsStruct
{
[MarshalAs(UnmanagedType.I4)]
public int abc;
}
[Guid("FEBA02D0-26D6-4aed-9621-53FDA3D6680C")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _ComTest1
{
[DispId(1)]
void test1(int x);
[DispId(2)]
void test2(TetsStruct TS);
}
[Guid("52097836-D464-4908-ADC5-5CE993173271")]
[ClassInterface(ClassInterfaceType.None)]
public class ComTest1 : _ComTest1
{
public void test1(int x) {}
public void test2(TetsStruct TS) {}
}
Thanks
Hagay
07-13-2010 09:03 AM - edited 07-13-2010 09:05 AM
Using structs in COM is not ole automation compatible and not supported. You would have to create an interface with properties instead and access those.
But why are you even using ActiveX? You can call .NET code directly from TestStand using the .NET adapter and the .NET adapter does support structs.
Hope this helps,
-Doug