How to marshal a COM-Parameter as VT_ARRAY of VT_RECORD

Posted by Oliver Japes on Stack Overflow See other posts from Stack Overflow or by Oliver Japes
Published on 2012-11-20T10:56:31Z Indexed on 2012/11/20 11:01 UTC
Read the original article Hit count: 513

Filed under:
|
|
|

I've already done some extensive search, but I can't seem to find anything matching my problem.

The task I'm currently working on is to create a WCF-Wrapper for some DCOM-Objects. This already works great for the most parts, but now I'm stuck with one invocation that expects a VT_ARRAY containing VT_RECORD-Objects.

Marshalling as VT_ARRAY is not a problem, but how can I tell COM that the elements in this array are VT_RECORDs?

This is the invocation as I current use it.

InitTestCase(testCaseName, parameterFileName, testCase, cellInfos.ToArray());

The parameter I'm talking about is the last one. It's defined as List<CellInfo>, CellInfo itself is already attributed with Guid("7D422961-331E-47E2-BC71-7839E9E77D39") and ComVisible(true). It's not a struct but a class.

This is the condition failing on the native side: if (VT_RECORD == varCellConfig.vt)...

Because of old software using these interfaces, changing the native side is not an option

Any idea?

© Stack Overflow or respective owner

Related posts about c#

Related posts about com