在C#COM对象上实现IProvideClassInfo

时间:2009-03-04 16:05:32

标签: c# com interop com-interop wsh

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

有人设法做到了吗?

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

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

// It fails on this 
var obj = WScript.CreateObject ("Promotions.Promotion", "AP_");

1 个答案:

答案 0 :(得分:1)

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

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

相关问题