Sending ActiveX Objects to the Client

To instantiate an ActiveX control on the client, you simply include the <object> tag in the response. For example, the angledText.html file code in Listing 20.13 shows a Label control that displays angled text (see Figure 20.7).

Listing 20.13: ActiveX Control Example for IE (angledText.htm)

<body bgColor=#c0c0c0> <OBJECT

classid="clsid:9 9B4212 0-6EC7-11CF-A6C7-0 0AA00A4 7DD2" codebase="http://activex.microsoft.com/controls/iexplorer/ ielabel.ocx#Version=4,7 0,0,1161" id="spinner" width=250 height=250 align=left hspace=20 vspace=0

<PARAM NAME="Angle" VALUE="45"> <PARAM NAME="Alignment" VALUE="4"> <PARAM NAME="BackStyle" VALUE="0"> <PARAM NAME="Caption" VALUE="Angled Text">

<PARAM NAME="FontName" VALUE="Arial, Verdana, Helvetica, Sans Serif">

<PARAM NAME="FontSize" VALUE="30"> <PARAM NAME="FontBold" VALUE="1"> <PARAM NAME="FrColor" VALUE="0"> </OBJECT>

rfr 'VH

Figure 20.7: The ActiveX Label control lets you display angled text on the page.

rfr 'VH

Figure 20.7: The ActiveX Label control lets you display angled text on the page.

The browser uses the classid attribute of the <object> tag to find and instantiate the Label object on the client. Because the Label control may not be installed on all clients, the preceding example includes an optional codebase attribute. If the control is not installed, the browser will use the codebase attribute value (a URL) to download it and then—depending on the user's security settings— ask the user whether to install the control.

Was this article helpful?

0 0

Post a comment