我正在尝试在C#COM对象上实现 IProvideClassInfo ,以便可以从Windows脚本宿主(WSH)使用它的事件。我已设法实现接口并跟踪对我的 GetClassInfo 方法的调用。但是,挂起事件会因无法连接对象而失败。

有人设法做到了吗?

这是我的脚本代码(JScript):

function AP\_GetActionsResponse ()
{           
WScript.Echo ("AP\_GetActionsResponse event");
}

// It fails on this 
var obj = WScript.CreateObject ("Promotions.Promotion", "AP_");
有帮助吗?

解决方案

好的我想通了 - 你必须在事件界面上指定一个DispId,否则它不起作用。

不需要实现IProvideClassInfo,但如果需要,可以使用。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top