BlueZone Visual Basic Help
The Seagull Web to Host Control Module (sglw2hcm.ocx) can be used to embed a BlueZone terminal emulation session in a Visual Basic form. This is useful when integrating terminal emulation along with other functionality in a Visual Basic application. Once the BlueZone session is running in the form, it can be controlled by your Visual Basic application via the BlueZone Host Automation Object.
SEE BlueZone
Host Automation Object Help for more information.
The following is a block diagram showing the Seagull Web-to-Host Control Module embedded in a Visual Basic Form using the BlueZone Host Automation Object (HAO) to communicate with the Visual Basic code.
Microsoft Visual Basic Editor installed
BlueZone Desktop or BlueZone Web-to-Host Installed
This feature is new in BlueZone 4.0. Simply install BlueZone using the setup program or BlueZone Web to Host. Once installed, the Seagull Web to Host Control Module component will be available to Visual Basic.
NOTE During
the BlueZone Desktop installation, the Seagull Web-to-Host Control Module
file (sglw2hcm.ocx ) is automatically copied to the BlueZone installation
folder.
The first step is to enable the Seagull Web-to-Host Control Module in the Visual Basic IDE.
Start a new Microsoft Visual Basic project.
From the MenuBar, choose Project:Components. A list of controls will be displayed.
Scroll down and check the box for the Seagull Web-to-Host Control Module as shown here:
Click the OK button. Immediately, an icon for the Seagull Web-to-Host Control Module control will be added to the bottom of the Components ToolBar in the Visual Basic IDE as shown here:
The next step is to place the Seagull Web-to-Host Control Module in a form.
If you don't already have one, add a form to your project in which to place the control.
Size the form to roughly the desired size. This can always be changed later.
Select (single click) the Seagull Web-to-Host Control component button on the Component ToolBar.
Place the cross hair cursor on the form, left click and drag the component until the desired dimensions are reached, then release. The control will display the BlueZone swirl when in design mode as shown here:
Once the control has been added to the form, it can be configured to embed the BlueZone session.
Right-click anywhere on the control and select Properties from the pop-up menu. A configuration dialog will be displayed as shown here:
The property pages in this dialog are used to configure the control. Most of the settings can be left at the default values for the majority of applications.
The General tab settings are described in the following table:
Local Launch |
Tells the Control how to launch BlueZone |
• No |
Tells BlueZone to run in Web-to-Host Mode and to use the control and files from a web server. |
• Yes |
Tells BlueZone to run in Web-to-Host mode and use the files in the Web to Host cache directory, without contacting the web server. |
• Desktop |
Use a BlueZone Desktop installation. |
Initialization File |
Used to specify the file containing the initialization information when running in Web-to-Host mode. Not required in Desktop mode. |
Distribution File |
Specifies the distribution file to use. Web-to-Host mode only. |
Cache Directory |
Specifies the cache directory to use. Web-to-Host mode only. |
Log Events |
Enables tracing of all of the controls functions for troubleshooting. |
The Sessions tab contains settings for all of the session types supported by the Seagull Web-to-Host Control Module. Only the settings for the session type specified in the Sessions: edit box need to be completed.
The Sessions tab settings are described in the following table:
Sessions |
Specifies which session type will be used: MD = Mainframe Display AD = AS400 (iSeries) Display VT = VT Display |
Profile |
Complete only for the Session type specified above: The name of the file containing the configuration settings for BlueZone. |
Allow the User to Save Settings |
Complete only for the Session type specified above: Yes = The user is allowed to make changes and save them to the profile. No = The user is not allowed to make any changes to the profile. |
Run Session in Container |
Complete only for the Session type specified above: Yes = BlueZone will be embedded in the control at the size specified by the form. No = BlueZone will run in a separate window. |
The Launch Pad tab enables or disables the Launch Pad feature. The Launch Pad is only used in Web-to-Host mode.
SEE The
BlueZone Web-to-Host Administrator’s
Guide for more information.
The Launch Pad tab settings are described in the following table:
Enable Launch Pad |
Controls the Launch Pad feature. |
• Yes |
Enables the Launch Pad, requiring user to select a BlueZone session to run. |
• No |
Disables the Launch Pad, resulting in BlueZone sessions launching automatically. |
Launch Pad Border |
Enables or Disables the border on the Launch Pad Window. |
Launch Pad Toolbar |
Enables or Disables the Launch Pad ToolBar. |
Launch Pad View |
Sets the view for icons in the Launch Pad. |
Launch Pad Buttons |
Enables or disables the Launch Pad buttons. |
Foreground Color |
Sets the foreground color of the Launch Pad. |
Background Color |
Sets the background color of the Launch Pad. |
Watermark Image |
Specifies the filename for a bitmap used as a background image in the Launch Pad. |
The Options tab is used to configure HTTP and Proxy settings. Unless you are using a proxy server to connect to the Internet, you probably not have to change any of these settings.
The Options tab settings are described in the following table:
Cache Retries |
Web to Host mode only. Leave at the default value. |
Cache Timeout |
Web to Host mode only. Leave at the default value. |
Max HTTP 1.1 Connects |
Sets the max number of connections the control will use to download files. Leave at the default value. |
Max HTTP 1.0 Connects |
Sets the max number of connections the control will use to download files. Leave at the default value. |
Local Proxy Port |
Sets the proxy port to access the internet. |
License Manager Address |
Specifies the address for the SEAGULL License Manager. This is only necessary if the address is not stored in the profile. |
License Manager Port |
Specifies the port for the SEAGULL License Manager. This is only necessary if the port is not stored in the profile. |
When you are finished, click the OK button. The Seagull Web-to-Host Control Module is now configured.
When BlueZone is running in the Visual Basic application, it can be controlled using a COM object called the BlueZone Host Automation Object. It is instantiated using the CreateObject method. Once created, any of the BlueZone Host Automation Object's methods and properties may be called by your Visual Basic application.
The following "sample code" shows the correct way to instantiate the BlueZone Host Automation Object and launch a BlueZone session.
Sample Code:
Option Explicit
Dim bzhao As Object
Private Sub Form_Unload(Cancel As Integer)
bzhao.Disconnect
End Sub
Private Sub Sglw2hcm1_AfterConnect(ByVal Success As Long)
Set bzhao = CreateObject("BZWhll.WhllObj")
bzhao.Connect "A"
bzhao.WaitForText "Choice:", 23, 7, 10
bzhao.SendKey "3"
bzhao.WaitReady 0, 100
bzhao.SendKey "@E"
bzhao.WaitReady 0, 100
bzhao.SendKey "3"
bzhao.WaitReady 0, 100
bzhao.SendKey "@E"
End Sub
Once a BlueZone session is launched successfully, simply configure it and save the setting to the Profile specified in the Sessions tab.
The above sample code is designed to work with BlueZone VT. To use it as a test, follow these steps:
Use BlueZone Desktop or BlueZone Web-to-Host to launch a BlueZone VT emulation session.
Configure the session to automatically connect to the Library of Congress host using the following host address: locis.loc.gov on port 23.
In addition to host IP address and port, make any additional configuration changes at this time. All BlueZone features including the keyboard map, display colors, display font, ToolBar settings, etc. are contained in the BlueZone configuration file.
Save the BlueZone VT configuration and give it the name "test.zvt".
Follow the steps above for creating a Visual Basic Project, inserting the Seagull Web-to-Host Control Module in a form, and making sure that your Seagull Web-to-Host Control Module is configured exactly the same way as the above screen shots.
Insert the above "sample code" into your Visual Basic project.
Run the application
by clicking the Start button located on the Visual Basic
IDE ToolBar.
BlueZone VT should launch in the form, connect to the Library of Congress host and select menu item number 3, Federal Legislation, then select item number 2, Congress, 1983-84.
The above sample code demonstrates the ability for BlueZone VT to automatically connect to a host, "wait for" a specific string of characters to appear on the screen, and navigate to a specific location on the host.
SEE BlueZone
Host Automation Object Help for more information.
Related Topics:
Related BlueZone Host Automation Object Methods