Calling a member of IDispatch COM interface from C#

后端 未结 2 985
感情败类
感情败类 2020-12-03 12:49

I wanted to call the GetIdsOfNames function from a COM object that implements the IDispatch interface in c#. I\'ve written the following code but it fails with the DISP_E_UN

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 13:18

    No you cannot, because InvokeMember internally uses GetIDsOfNames, and this one only checks actual methods, not the first 6 in IDispatch. Or in other words, GetIDsOfNames cannot be invoked using IDispatch's method Invoke. That is how COM works.

提交回复
热议问题