Responding to events using the ActiveX Control on a Web Page

This web page contains a Reflection for IBM ActiveX Control. When the page loads:

· The Reflection for IBM 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.

<HTML>

<HEAD>

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

</HEAD>

 

<BODY>

 

<H2>Reflection for IBM ActiveX Demo </H2>

 

<P></P>

 

<OBJECT ID ="RibmCtrl"

 CLASSID="clsid:7D3AFC5D-6CFF-4E1F-9C41-033422F85734"

 WIDTH=380

 HEIGHT=280>

</OBJECT>

 

<SCRIPT LANGUAGE="VBScript">

<!--

 

Dim Ribm 'Reflection object assigned to the active session

 

'Define constants used by the Reflection Session object

const rc5250Terminal = 3

const rc31792 = 31

const rcDemo = 3

rcNextEvent = 0

rcEvConnected = 2

rcEnable = 1

rcEventReenable = 1

 

Sub Window_OnLoad() 

 

Set Ribm = RibmCtrl.GetActiveSession

With Ribm

'Configure connection

Ribm.SetupSession rc5250Terminal, rc31792, rcDemo

.Hostname = "ribm5250.sim"

 

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

.OnEvent rcNextEvent, _

rcEvConnected, _

"RaiseControlEvent 0, ""Connected!""", _

rcEnable, _

rcEventReEnable, _

"", 0, 0

End With

 

End Sub

 

Sub RibmCtrl_OnReflectionEvent(eventNumber, eventData)

Msgbox eventData, , "Reflection"

End Sub

 

-->

</SCRIPT>

 

</BODY>

</HTML>