17 07 7AZNIUCO2ARAKNM3SCNF34FUOVDPA7OS5SBNURQ




Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!:ActiveX Controls
function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { var end = document.cookie.indexOf (";", j); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(j, end)); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } var m1=''; var gifstr=GetCookie("UsrType"); if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; } document.write(m1+m2+m3);            Keyword Title Author ISBN Publisher Imprint Brief Full  Advanced      Search  Search Tips Please Select ----------- Components Content Mgt Certification Databases Enterprise Mgt Fun/Games Groupware Hardware IBM Redbooks Intranet Dev Middleware Multimedia Networks OS Prod Apps Programming Security UI Web Services Webmaster Y2K ----------- New Titles ----------- Free Archive To access the contents, click the chapter and section titles. Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 Publication Date: 08/01/98 function isIE4() { return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') ); } function bookMarkit() { var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0"; parent.location.href=url; //var win = window.open(url,"myitk"); //if(!isIE4()) // win.focus(); } Search this book:  














Previous
Table of Contents
Next




What exactly does it mean to “use” an ActiveX control on the Web? Remember that one of the important characteristics of an ActiveX control is its ability to be contained within something. In the section on testing your ActiveX control, you saw how you can use either a Visual Basic project or a Web browser to contain an ActiveX control. To use a Web browser, you must reference the control within a Hypertext Markup Language (HTML) document. When the HTML document is viewed within a Web browser, the ActiveX control and its functionality are part of the page. How is this done?

An HTML document contains not only the text to be displayed, but also a variety of HTML codes that control the text formatting, page layout, and other aspects of the page’s appearance. To include an ActiveX control in an HTML document, the <OBJECT> code is used. Here’s an example of the HTML code that would insert an AnimatedButton object on an HTML page:


<OBJECT ID=“anbtn1” WIDTH=104 HEIGHT=60
CLASSID=“CLSID:0482B100-739C-11CF-A3A9-00A0C9034920”>
<PARAM NAME=“_ExtentX” VALUE=“2752”>
<PARAM NAME=“_ExtentY” VALUE=“1588”>
<PARAM NAME=“defaultfrstart” VALUE=“0”>
<PARAM NAME=“defaultfrend” VALUE=“-1”>
<PARAM NAME=“mouseoverfrstart” VALUE=“0”>
<PARAM NAME=“mouseoverfrend” VALUE=“-1”>
<PARAM NAME=“focusfrstart” VALUE=“0”>
<PARAM NAME=“focusfrend” VALUE=“-1”>
<PARAM NAME=“downfrstart” VALUE=“0”>
<PARAM NAME=“downfrend” VALUE=“-1”>
</OBJECT>


Let’s dissect this code to see what its components are:


•  The first line specifies the object’s ID, which is similar to an object’s Name property. It also specifies the object’s screen display size.
•  The second line specifies the object’s class identifier, a unique alphanumeric code that identifies the specific ActiveX control being referred to.
•  The third through twelfth lines pass parameters to the object. Essentially, these are object property values that will be in effect when the object is first created as part of the page.
•  The final line marks the end of the ActiveX object code.

How do you access the information required to place these codes in your HTML documents? Microsoft has provided a couple of handy tools for this purpose. One of them, the ActiveX Control Lister, or ACLIST, is provided on this book’s CD-ROM. When it runs, it presents you with a list of all the available ActiveX controls. Double-click on a control name, and the relevant information is placed on the Clipboard, allowing you to paste it into your HTML document. The other Microsoft tool, called the ActiveX Control Pad, provides the same ability to paste ActiveX information into HTML documents, along with other HTML document creation capabilities. You can download this program from Microsoft’s Web Site at www.microsoft.com/workshop/author.
For controls you have created, another method is available. When you test the control in a browser, as described earlier in this chapter, Visual Basic creates a small HTML file containing a reference to the control. The file is named xxxx.html, where xxxx is the control name. For example, here are the contents of FancyCmdButton.html, the test html file created for the ActiveX control developed in this chapter:


<HTML><BODY>
<OBJECT classid=“clsid:B710E225-EA43-11D1-AF5F-00A024D13692”>
</OBJECT>
</BODY></HTML>


By viewing this file, you can obtain the class ID for the control.

What happens when a Web browser loads an HTML document containing code meant to load an ActiveX object? First of all, it depends on the browser—not all browsers support ActiveX controls. At this writing, only Microsoft Internet Explorer version 3 and higher provides this support. I suspect that Netscape Navigator will soon follow.
In any event, when a browser that supports ActiveX controls encounters this code, it checks to see if the ActiveX control has been installed on the local system (identifying the control by means of the class ID in the code). If so, an instance of the control is created and loaded into the page, with the browser serving as container.
What if the ActiveX control has not been installed? Here’s the beauty of using ActiveX on the Web. The browser will download the control from the Web site itself and install it on your system. Thus, the Web developer can use ActiveX controls on his or her Web pages without being concerned about whether or not the users have the controls installed. Once the control has been installed, that’s it—there’s no need to install it again. It will be available for any future use.
The ability to download and install ActiveX controls automatically from a remote site is indeed powerful. It opens several other concerns, however, including the process of installing controls on a Web site, so they are available for download. Security issues are also important. Visual Basic provides some sophisticated tools for distributing applications, and I will cover these in Chapter 26.



Previous
Table of Contents
Next






Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.

Wyszukiwarka

Podobne podstrony:
R 17 07
cwiczenia EK D zad 3 17 07
ustawa o samorządzie powiatowym 17,07,2015
07 17
07 17 Styczeń 1998 Kaukaz nie ma dokąd odejść
1997 07 str 17 Dziwne atraktory

więcej podobnych podstron