
Binding events to handlers
I wish to capture events generated by an atomation object in a VB script executed
in WSH.
On msdn I've found how to do this in
Visual Basic, but I can't figure how to do
in
VBScript.
For example in the following script, how can I bind the OnQuit event of
InternetExplorer object with an suitable handler? I suppose I've to define a class
but I don't know how.
Option Explicit
Dim IE
Private Sub IE_onclick()
IE.navigate " http://www.*-*-*.com/ "
End Sub
Sub IE_onQuit
MsgBox("IE quitted")
End Function
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "about:blank"
IE.visible=True
Set IE.Document.onClick=getref("IE_onClick")
MsgBox("Click here to finish ")
Set IE = Nothing