First I edit the AXGlue web page using Microsoft’s ActiveX Control Pad application. This is a wonderful piece of software that Microsoft distributes for free on the Internet (http://www.microsoft.com/workshop/author/cpad); it does most of the work needed to add ActiveX controls to an HTML document. Here’s the edited HTML for the web page.
<html>
<head>
<title>AXGlue Applet</title>
</head>
<body>
<H1>AXGlue Applet</H1>
<P>
This application shows how ActiveX components can be linked
via Visual Basic, Scripting Edition, and Java applets
</P>
<P>
<hr>
<OBJECT ID="AXTimer" WIDTH=39 HEIGHT=39
CLASSID="CLSID:59CCB4A0-727D-11CF-AC36-00AA00A47DD2">
<PARAM NAME="_ExtentX" VALUE="1005">
<PARAM NAME="_ExtentY" VALUE="1005">
<PARAM NAME="Interval" VALUE="0">
</OBJECT>
<OBJECT ID="AXLabel" WIDTH=100 HEIGHT=100
CLASSID="CLSID:99B42120-6EC7-11CF-A6C7-00AA00A47DD2">
<PARAM NAME="_ExtentX" VALUE="3625">
<PARAM NAME="_ExtentY" VALUE="3625">
<PARAM NAME="Caption" VALUE="Rotate!">
<PARAM NAME="Angle" VALUE="0">
<PARAM NAME="Alignment" VALUE="4">
<PARAM NAME="Mode" VALUE="1">
<PARAM NAME="FillStyle" VALUE="0">
<PARAM NAME="ForeColor" VALUE="#000000">
<PARAM NAME="BackColor" VALUE="#B0C4C8">
<PARAM NAME="FontName" VALUE="Arial">
<PARAM NAME="FontSize" VALUE="20">
<PARAM NAME="FontItalic" VALUE="0">
<PARAM NAME="FontBold" VALUE="1">
<PARAM NAME="FontUnderline" VALUE="0">
<PARAM NAME="FontStrikeout" VALUE="0">
<PARAM NAME="TopPoints" VALUE="0">
<PARAM NAME="BotPoints" VALUE="0">
</OBJECT>
<P>
<hr>
<applet
code=AXGlue.class
name=AXGlue
width=320
height=240 >
</applet>
<hr>
<a href="AXGlue.java">The source.</a>
<SCRIPT language="VBScript">
<!--
sub window_onLoad
document.AXGlue.setLabelCtl AXLabel
document.AXGlue.setTimerCtl AXTimer
/AXTimer.Interval = 1000
end sub
sub AXTimer_Timer
document.AXGlue.changeLabel
end sub
-->
</SCRIPT>
</body>
</html>
After some quick explanatory headers, I insert a Timer control named AXTimer and a Super Label control named AXLabel. The ActiveX Control Pad automatically includes the appropriate IDs and parameters for each control, based on their registered definitions. Visual Studio adds the instructions for loading the AXGlue applet. The script performs two tasks:
That’s the only code needed to link the ActiveX controls to the Java applet! Now let’s look at the Java code and see what’s going on there.