Implementing IProvideClassInfo on C# COM Object
-
03-07-2019 - |
Question
I'm trying to implement the IProvideClassInfo
on a C# COM object so its events can be used from Windows Script Host (WSH). I've managed to implement the interface and trace a call in to my GetClassInfo
method. However, hooking up the events fails with Cannot connect object
.
Has anyone managed to do this?
This is my script code (JScript):
function AP\_GetActionsResponse ()
{
WScript.Echo ("AP\_GetActionsResponse event");
}
// It fails on this
var obj = WScript.CreateObject ("Promotions.Promotion", "AP_");
Solution
Okay I figured it out - You must specify a DispId on the event interface or it doesn't work.
There's no need to implement IProvideClassInfo, but you can if you want.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow