Responding to events using the ActiveX Control on a Web Page

This web page contains a Reflection for UNIX and OpenVMS ActiveX Control. When the page loads:

· The Reflection control is configured to connect to a demonstration host.

· An event is defined using the OnEvent method. This event triggers the RaiseControlEvent method.

When you display the page and connect to the host (by clicking the connect button), the event procedure uses OnReflectionEvent to display the string data sent from Reflection.

<HEAD>

<TITLE>Reflection ActiveX Control Demonstration Page</TITLE>

</HEAD>

<BODY>

<H2>Reflection for UNIX and OpenVMS ActiveX Demo </H2>

 

<OBJECT ID ="R2winCtrl"

 CLASSID="clsid:15B168B2-AD3C-11D1-A8D8-00A0C9200E61"

 WIDTH=380

 HEIGHT=280>

</OBJECT>

 

<SCRIPT LANGUAGE="VBScript">

<!--

 

Dim RUD 'Reflection object assigned to the active session

 

'Define constants used by the Reflection Session object

const rcNextEvent = 0

const rcEvConnected = 2

const rcVBCommand = 9

const rcEnable = 1

const rcEventReenable = 1

 

Sub Window_OnLoad() 

 

Set RUD = R2winCtrl.GetActiveSession

With RUD

'Configure connection

.ConnectionType = "DEMONSTRATION"

.ConnectionSettings = "Host ""UNIX"""

 

'Define an event to take place when a connection is made

.OnEvent rcNextEvent, _

rcEvConnected, _

rcVBCommand, _

"RaiseControlEvent 1, ""Connected!"" ", _

rcEnable, _

rcEventReenable

 

End With

 

End Sub

 

Sub R2winCtrl_OnReflectionEvent(eventNumber, eventData)

Msgbox eventData, , "Reflection"

End Sub

 

-->

</SCRIPT>

 

</BODY>

</HTML>