Table of Contents
VB Bridge 2.0 Online Manual

CREATING PROGRAMS

When the installation is complete, let’s begin using VB Bridge. First of all, let’s create the HTML that will make up the user interface. As an example, we’ll create a program that will display the words "HELLO WORLD".

First, create a file called helloworld.htm using the editor.

<HTML><BODY>
<HEAD><TITLE>VB Bridge Hello World</TITLE></HEAD>
<H2>VB Bridge Hello World Sample</H2>
<FORM METHOD="POST" ACTION="/scripts/vb_bridge2/vb_bridge.dll">
<INPUT TYPE="HIDDEN" NAME="VBEXE" SIZE=0
VALUE="c:\inetpub\scripts\vb_bridge2\helloworld.exe">
<INPUT TYPE="TEXT" NAME="STRING" SIZE=50 VALUE="Hello World">
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY></HTML>

When you open this file in a browser, it appears as below:

In the above HTML code, there are several important HTML tags that are used to communicate with VB Bridge. We will explain the important tags using the “Hello World” example.

<FORM METHOD="POST" ACTION="/scripts/vb_bridge2/vb_bridge.dll">

The above section defines how the form that you have created are passed to the server, in this case a "POST" method. It also defines the path on the server where vb_bridge2.dll is installed. The above example indicates that vb_bridge2.dll is installed in the scripts\vb_bridge2\ directory on the IIS server.

<INPUT TYPE="HIDDEN" NAME="VBEXE" SIZE=0 VALUE="c:\inetsrv\scripts\vb_bridge2\helloworld.exe">

This section of the HTML code defines the location of the helloworld.exe program on the IIS server for VB Bridge to call and execute. In this case, helloworld.exe will be created in the same "scripts\vb_bridge2\" directory that vb_bridge2.dll is located in.

<INPUT TYPE="TEXT" NAME="STRING" SIZE=50 VALUE="Hello World">

Next, this line defines the field that will contain the text to be passed to IIS. Please remember that in the above example, the inputted text will be passed to IIS under the name STRING.

<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>

Finally, this command passes the completed form to the server. This completes the HTML form section.

After creating the HTML that becomes the user interface, we will create helloworld.exe using Visual BASIC. First of all, click on "\Inetpub\scripts\vb_bridge2\bin\vbbridge2.bas" to start Visual BASIC.

As shown on the following screen, vbbridge2.bas is read into Project1 as a module. Then, we will use the Add File (Ctrl-D) command found at the bottom of the Project menu to insert sample_confirm.bas as a template for helloworld.bas.

After completing the above, the preparation to begin coding is complete. The development of server applications using VB Bridge is conducted entirely using HTML files as the user interface. This means that there is no need to use the normal Visual BASIC forms.

Now, click Properties at the bottom of the Project menu and rename your project from Project1 to helloworld. By changing this property, the project name of the program that you are going to make will be helloworld.vbp.

Next, let’s change the name of the sample_confirm.bas file to helloworld.bas. Highlight the module and select Save file as... from the File menu and save the file as helloworld.bas instead of sample_comfirm.bas. The project window should appear as follows:

With this, our preparations are complete and we are ready to create the program. To begin programming, double click helloworld.bas module in the project window. Edit the helloworld.bas file as follows:

'--------------------------------------------------------
' HELLOWORLD.BAS
' VERSION: 1.0 (June 2, 1997)
'--------------------------------------------------------
Global g_sSTRING As String

Sub Program_Main()
SetServerAdminiEmail ("you@mailserver.com") ' Set Administrator E-Mail Address for error occurred

SetSTRING
ReturnToISAPI (1)

End Sub

Public Sub SetSTRING()

g_sSTRING = GetField("STRING")

Send ("Content-Type: text/html" + Chr(13) + Chr(10) + Chr(13) + Chr(10))
Send ("<HTML>" + Chr(13) + Chr(10))
Send ("<BODY>")
Send ("<HEAD><TITLE>Hello World</TITLE></HEAD>" + Chr(13) + Chr(10))

Send ("<P>" + g_sSTRING + "</P>")

Send ("</BODY>" + Chr$(13) + Chr$(10))
Send ("</HTML>" + Chr$(13) + Chr$(10))

End Sub

The above module must be compiled with the vbbridge2.bas module to create helloworld.exe. Place the newly created helloworld.exe program in the "\Inetpub\scripts\vb_bridge2\" directory.

Open the helloworld.htm file that we created at first in a browser (this must be done over a TCP/IP connection). When you click the Submit button, the helloworld.exe program that you just created will be executed and the words "Hello World" will appear in your browser.

The operations up to this point have involved using VB Bridge in the Windows NT/IIS environment to create a program. However, the program that you have created will run not only from the Windows environment, but from Macintosh and Unix computers as well. It means that this is a multi-platform program. You can also use VB Bridge to build TCP/IP client server applications using Visual BASIC.

Due to the fact that the program you have created uses the IIS ISAPI program interface, you can achieve response times that would be unheard of with CGI.

Until you become more familiar with VB Bridge, we recommend creating your own programs by simply editing the contents of the sample program modules included with VB Bridge.