Pass VT_ARRAY object to COM

I have a COM object that exports such a function:

SetValue(Guid paramID, ref object paramValue);

For a specific Guid, I have to pass paramValue as "VT_ARRAY | VT_INT", as the document says. Indeed, I have to pass 4 integers that are 16 bytes (4x4). It is simple in C ++, but I could not do it in C #. How to pass VT_ARRAY from C # to COM?

I tried this:

object[] values = new int[4];
// set values[0]-[4] some numbers
comObj.SetValue(new Guid(Guid_str), ref values);

But he says: It is not possible to convert the parameter ref object [] to ref object .

I also tried to create a structure and pass it to a function, but it causes a runtime error. Perhaps I could not correctly identify it.

+3
source share

All Articles