To make this work, the HTML for Connect Four includes information
that tells the browser where to get the controls. This is specified
using the CODEBASE attribute, which is part of the OBJECT tag. In
this case, two servers are required: ThreeD32.ocx and InTimer.ocx.
Here are the OBJECT tags that use the CODEBASE attribute:
Tip: Stick to the subset. VBScript is missing some of the features
of Visual Basic, so you need to stick to the subset when developing
VBScript-based solutions. VBScript is a pretty complete subset so
this isn't very hard. Types, ByRef parameters, and records are a few
of the more important omissions.
Tip: Put all the code in one VB form. Its easiest to move code
between VBScript and VB if all of the code is in one form. During
development, it is common to copy all the code from the form and paste
it wholesale into the HTML, in-between "<SCRIPT>" and "<SCRIPT>".
Tip: Use the HTML intrinsic controls on VB forms. Internet Explorer
3.0 uses ActiveX Controls for the HTML intrinsics. You can use these
in Visual basic 4.0 too. To do so, just reference HTMLCtl.ocx, which
you'll find in your windows/system directory once you've installed IE3.
Connect Four Sample
Automatic component download
Connect Four demonstrates automatic component download, which is
part of the ActiveX platform. The page requires to ActiveX
Controls to be installed. When the page loads, the browser
checks to see if the controls are installed already. If they're
not, then the browser uses a system-provided component download
service to download and install the controls automatically.<OBJECT ID=Square16
CLASSID="clsid:0BA686B9-F7D3-101A-993E-0000C0EF6F5E"
HEIGHT=30 WIDTH=30
CODEBASE="/vbscript/us/vbssamp/commoncode/threed32.ocx">
</OBJECT>
<lOBJECT ID=TimerControl
CODEBASE="/vbscript/us/vbssamp/commoncode/intimer.ocx"
CLASSID="clsid:59CCB4A0-727D-11CF-AC36-00AA00A47DD2"
HEIGHT=30 WIDTH=120>
<PARAM NAME="TimeOut" Value = 1000>
</OBJECT>
Using Visual Basic 4.0 to target VBScript
Visual Basic 4.0 is a useful tool for building solutions that use
VBScript. Since VBScript is a strict subset of VB, VB can easily
be used to build complex web-based solutions. Connect Four was
developed and debugged using VB4. This section provides some simple
tips for using VB4 to debug VBScript-based solutions.