Passing an array of Structs to a COM Interface

前端 未结 1 1295
甜味超标
甜味超标 2021-01-28 05:08

I have a COM interface with an IDL file with the following declared:

typedef [uuid(D7B6C495-FFF3-11E0-8A39-08002700D831)]
struct PORT_CONFIG
{
  unsigned char  r         


        
1条回答
  •  有刺的猬
    2021-01-28 05:44

    I now have the answer to my own problem. For some reason the interop layer fails on SAFEARRAY parameters when the interop type is embedded (the default in VS2010). To work around this issue right-click the reference to the COM object and set Embed Interop Type to False.

    I wish that I could take credit for figuring out this answer, but the credit belongs to Michael Taylor:

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/1325d24c-db0f-43a1-9780-b68a843d816b

    0 讨论(0)
提交回复
热议问题