且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 C# 调用 IDispatch COM 接口的成员

更新时间:2023-02-09 15:16:41

不可以,因为 InvokeMember 内部使用 GetIDsOfNames,而这个只检查实际方法,而不是 IDispatch 中的前 6 个.或者换句话说,不能使用 IDispatch 的方法 Invoke 调用 GetIDsOfNames.这就是 COM 的工作原理.

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.