I need to pass an array of int or long (doesn't matter) from a VB6 application to a C# COM Visible class. I've tried declaring the interface in C# like this:
void Subscribe([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)]int[] notificationTypes)
void Subscribe(int[] notificationTypes)
But both of them raised a Function or interface markes as restricted, or the function uses an Automation type not supported in Visual Basic
.
How should I declare the C# method?
If you get desperate, code the signature in a dummy VB6 ActiveX dll project. Then generate the .NET Interop version of the vb6 component via Visual studio or the command line tool. Then use Reflector or dotPeek to pull the code out of the interop assembly. It is the long way around, but it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With