Microsoft DirectX 9.0

Binding Event Handlers to Events in Script Applications

This topic applies to Windows XP only.

For script-based applications running in Microsoft Internet Explorer, the application must explicitly associate event handling methods with their respective events. The MSEventBinder object is provided for this purpose. Its use is illustrated in the following code:

<HEAD>
<OBJECT id=Binder classid="clsid:577FAA18-4518-445E-8F70-1473F8CF4BA4"></OBJECT>
<script language="vbscript">
dim bind_1

sub window_onload
  bind_1 = Binder.Bind(VidCtl, "StateChange", "handleStateChange")
end sub

sub handleStateChange(laststate, curstate)
  if curstate = 0 then
    StateSpan.innerHTML = "Stop"
  elseif curstate = 1 then
    StateSpan.innerHTML = "Pause"
  elseif curstate = 2 then
    StateSpan.innerHTML = "Play"
  end if
end sub

sub close()
  Binder.Unbind(bind_1)
end sub
</script>
</HEAD>
<BODY>
<OBJECT ID="VidCtl" DATA="tv:"></OBJECT>
<P>Current State: <SPAN style="color:red" id="StateSpan">Unknown</SPAN></P>
</BODY>
</HTML>