Layout ] Multimedia ] Programming ] Scripting ] Communicate ] Navigation ]

ActiveX Example 4

Up ] Script Tag Syntax ] Forwarder Script ] Extra IE Features ] ActiveX Example 1 ] ActiveX Example 2 ] ActiveX Example 3 ] [ ActiveX Example 4 ]

This is an example of using ActiveX controls in a web page. This example is only supports for Internet Explorer 4 and up. In this case, I used the Document.WriteLn method to put in the Object tags, so that IE3 would not download the control. With just a little work, you could use something similar to let the user have a choice whether or not to use the ActiveX control.  Something like this:

Sub LoadMSAgent()
Resp = Window.Confirm "Use the MS Agent control?"
If Resp Then
Window.Alert "Loading ActiveX Controls."
Document.WriteLn "<OBJECT ID='Agent' width=0 height=0"
Document.WriteLn "CLASSID='CLSID:F5BE8BD2-7DE6-11D0-91FE-00C04FD701A5'"
Document.WriteLn " CODEBASE='http://activex.microsoft.com/" & _
    "controls/agent/msagent.exe#VERSION=1,5,1,0'>"
Document.WriteLn "<" & Chr(47) & "OBJECT>"
Document.WriteLn "<OBJECT ID='TruVoice' width=0 height=0"
Document.WriteLn " CLASSID='CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575'"
Document.WriteLn " CODEBASE='http://activex.microsoft.com/" & _
    "controls/agent/cgram.exe#VERSION=1,5,0,0'>"
Document.WriteLn "<" & Chr(47) & "OBJECT>"
End If
End Sub

You could also write the object tags like this, eliminating the need for a LoadMSAgent function completely.

<OBJECT ID="Agent" width=0 height=0
CLASSID="CLSID:F5BE8BD2-7DE6-11D0-91FE-00C04FD701A5"
CODEBASE="http://activex.microsoft.com/controls/agent/msagent.exe#VERSION=1,5,1,0">
</OBJECT>
<OBJECT ID="TruVoice" width=0 height=0
CLASSID="CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575"
CODEBASE="http://activex.microsoft.com/controls/agent/cgram.exe#VERSION=1,5,0,0">
</OBJECT>

For further information on the Microsoft Agent Control, please see the MS Agent web site.

Layout ] Multimedia ] Programming ] Scripting ] Communicate ] Navigation ]
Script Tag Syntax ] Forwarder Script ] Extra IE Features ] ActiveX Example 1 ] ActiveX Example 2 ] ActiveX Example 3 ] [ ActiveX Example 4 ]

The Web Wizard's Spellbook © 1998, Team WWS