I wanted to know how to access events in JScript files. Here is the
scenario
// test.cs
using System;
public delegate void MyDel(string str);
namespace Test {
public interface IClass1 {
event MyDel del1;
void callDel1();
}
public Class1 : IClass1 {
public event MyDel del1;
public void calDel1() {
if (del1)
del1("Hi mom!");
}
}
}
// test.js
var test = new ActiveXObject('Test.Class1');
test.del1 = myEventHnd;
test.calDel1();
function myEventHnd(str) {
WScript.Echo(str);
}
OR CAN IT BE DONE LIKE THIS?..
// test.js
var test = new WScript.CreateObject('Test.Class1', 'test_');
test.del1 = myEventHnd;
test.calDel1();
function test_del1(str) {
WScript.Echo(str);
}