Advantages of Using ActiveX Controls

The <OBJECT> Tag

The <OBJECT> tag is used to insert objects such as ActiveX controls into HTML documents. <OBJECT> tags use attributes to define ActiveX controls, the location of objects, and how objects will be displayed on HTML pages.

<OBJECT> Tag Attributes

Attributes of the <OBJECT> tag include CLASSID, ID and CODEBASE, as well as WIDTH, HEIGHT, ALIGN, HSPACE, VSPACE, and BORDER.

CLASSID

When an ActiveX control is installed on a user 's computer, it is registered in the system registry with a unique class ID. The CLASSID attribute, which contains the class ID, is the only required attribute for the <OBJECT> tag.

Syntax

This is the syntax for the CLASSID attribute:
 CLASSID = "clsid:12345678-1234-1234-1234-123456789012" 

Example

This example shows the <OBJECT> tag for the Calendar control:
 <OBJECT classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" > </OBJECT> 

ID

The ID attribute enables you to refer to the object from VBScript.

Example

This example shows how to set the ID attribute of the Calendar control:
 <OBJECT classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" id=cldCalendar2 > </OBJECT> 

CODEBASE

The CODEBASE attribute is a Uniform Resource Locator (URL) that points to a file containing the implementation of an object.

WIDTH, HEIGHT, ALIGN, HSPACE, VSPACE, and BORDER

These attributes affect the way in which an object is positioned and sized on an HTML page, and whether or not it is contained in a border.

Obtaining the CLASSID of an Object

Visual InterDev and FrontPage 98 automatically search the registry for the class ID and write it in the generated <OBJECT> tag. You can determine the class ID for a control manually by using one of the following tools:
  • Registry Editor (RegEdit)

    The Registry Editor enables you to change settings in your system registry. You can also use it to view and copy the class ID for an object.

  • OLE Viewer (Ole2View)

    The OLE Viewer is installed with the Win32 Software Development Kit (SDK). You can use the Copy HTML <object> Tag to Clipboard command on the Object menu to copy the <OBJECT> tag to the Clipboard, and then paste the tag into an HTML page or an Active Server Page.

* To search for the Class ID of the Microsoft Calendar control:
  1. Start Regedit.exe.
  2. Click on the HKEY_CLASSES_ROOT folder.
  3. From the Edit menu, click Find .
  4. In the Find What field, type "Calendar Control 8.0" and click Find Next .

    The class ID for the Calendar control will be displayed on the left side of the window as an opened folder. The class ID should be similar to the following:

     {8E27C92B-1264-101C-8A2F-040224009C02} 
  5. Close RegEdit.

Supplying an Alternative for the <OBJECT> Tag

For Web browsers that do not support the <OBJECT> tag, or for users who have not enabled ActiveX controls in their Web browser, you should supply an alternate way to provide the same functionality. If a Web browser does not display ActiveX controls, it displays any HTML tags you place between the <OBJECT> and </OBJECT> tags.
Note

If a Web browser supports the <OBJECT> tag but the user does not install the ActiveX control, the Web browser displays an invalid control icon rather than provide the alternative functionality.


For example, for Web browsers that do not display the Calendar control, you can place a text box control on the Web page so that the user can still enter the date.

Example

This example places a text box control on a Web page:
 <OBJECT classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" >Best if viewed with Internet Explorer 4.0.<P> Type a date here:  <INPUT TYPE=TEXT NAME="Date" MAXLENGTH=10 SIZE=10> </OBJECT> 


Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net