COM对象对我来说是一个全新的领域,我搜索了很多而没有运气。我正在调用第三方COM对象,我可以让它做它应该做的事情,但它总是返回null,我需要下一步的值。它的示例是在Python中,它按预期返回。我的代码如下,我如何设置它以便获得返回值?
Type t = Type.GetTypeFromProgID("3rdParty.Name");
object publisher = Activator.CreateInstance(t);
object[] args = new object[6];
//fill in the args
//It works and does what it is supposed to behind the scenes,
//but need the int return value.
//Right now it is always null
int? handle = (int?)t.InvokeMember("DoYourThing",
BindingFlags.InvokeMethod,
null,
publisher,
args);