17 - Overview of ActiveX
- ActiveX Controls for the Internet - You'll use ActiveX Controls in many of the places you're using Java applets today.
- ActiveX scripting services - The ActiveX scripting service empowers you to add scripting and OLE automation capabilities to programs.
- ActiveX documents - ActiveX documents are based upon a more general abstraction called DocObjects-a set of extensions to OLE documents.
- The Internet Control Pack - Add Internet functionality to your applications with these easy-to-use ActiveX Controls.
- ActiveX server framework - High performance server side application for the Web is made possible with this framework.
ActiveX is not a single technological thing. If you've browsed Microsoft's Web site (www.microsoft.com), you've probably gathered that ActiveX is a centerpiece of Microsoft's overall Internet strategy. ActiveX helps application developers and Web content authors build dynamic Internet tools, content, and sites. That's a pretty tall order. To achieve this design goal, Microsoft needed to bring together a number of different components. When you're first introduced to a bunch of new items, it's often hard to assimilate all the pieces of information into an overall picture. (The old forest versus the trees problem). So this chapter will take you through a quick tour of all the major components of ActiveX, so that as you slice into the gory detail you won't lose sight of the overall ActiveX design.
As the content you consume from the Internet becomes more and more dynamic, the Web browser will be managing more and more of the computing tasks required to render that content. Much has been made of the executable content model for Web content. Sun Microsystem's Java takes early honors in the race for the development standard for executable content. Many Web sites employ simple multimedia widgets provided by Java, such as the Animator class.
Netscape helped to push Java into prominence by releasing Navigator 2.0 with support for Java applets. Java provides Web developers with a highly sophisticated tool set for interacting with the user and the client machine. Microsoft, not to be outdone, announced support for Java in MSIE 3.0 and a new alternative called ActiveX Controls. ActiveX Controls are based upon the OLE 2.0 standard. ActiveX Controls are to Web pages what the VBX and OCX are to MS-Windows GUI development. You'll use ActiveX Controls in many of the places you're using Java applets today. However, ActiveX Controls have the following advantages over Java applets:
- They are built from tools you already know.
- They are easy to integrate with other applications.
- They are easy to employ in containers that are not Web pages.
Let's take a brief look at each of these advantages.
Java requires that you learn an entire new language. Although Java and C++ have syntactic similarities, Java requires that you learn a whole new set of class hierarchies. (Of course, Java saves you from being engulfed in the search for "a pointer from hell" as in C++). When you consider all the methods and properties that you must learn to be proficient, its quite an undertaking. But, on the other hand, if you've been using C++ and have constructed an OCX, then you already know most of the basic concepts. Unfortunately, ActiveX Controls are not constructed using Microsoft Foundation Classes. Instead, Microsoft has made the ActiveX Template Library (ATL) available to help developers build ActiveX controls.
Because ActiveX Controls are based upon the OLE 2.0 specification, the potential for ActiveX Controls to interact with other applications like word processors, spreadsheets, and presentation opens many possibilities. Although stand-alone applications can be constructed using Java, Java does not really offer the same potential interaction with other existing applications yet.
As mentioned previously, Java can be used to produce other stand-alone applications. However, Java applets are intended to execute in a Web browser and not as controls in other applications. The Internet ActiveX Control Pack demonstrates the value of ActiveX in other development environments like Visual C++, Delphi, Visual Basic, and MS-Access. Microsoft's use of the OLE 2.0 specification as the basis for ActiveX Controls and their use in these other environments provides additional interoperability characteristics.
Of course, there are a couple of problems with the use of ActiveX Controls. You'll want to consider the following concerns:
- They are not currently supported in Netscape.
- They are not currently supported on UNIX platforms.
Why are these disadvantages important? Let's take a moment and discuss each problem briefly.
If Netscape continues to dominate the browser market and ActiveX is slow to take off, there is little advantage for Netscape in supporting ActiveX. Netscape provides support for Java and sees Microsoft as a significant competitive threat. However, Microsoft provides a plug-in (actually built by a third party) to allow support for ActiveX. (You can download it from www.microsoft.com). Plug-ins add functionality to Web browsers. So it is unlikely that this potential disadvantage will significantly affect the long run viability of ActiveX.
Many computers connected to the Internet are UNIX-based machines. Unfortunately, Microsoft has made no significant effort to deploy Microsoft technology to the UNIX platform. The Internet has thrived on the concept of open platform support. That is, most major Internet applications work on a diverse set of platforms. In fact, much of the Internet's recent surge in popularity is due to the platform independent nature of Web pages. With so many Internet users relying on UNIX machines, failure to support ActiveX on UNIX might seriously hamper market acceptance. However, Microsoft has indicated that ActiveX will be supported in the UNIX environment.
- ActiveX scripting hosts
- ActiveX scripting engines
An ActiveX scripting host provides a platform on which to run the ActiveX scripting engine. The principle ActiveX scripting host is MSIE 3.0. However, under ActiveX there are a number of potential script hosts, such as the following:
- Other Web browsers
- Internet authoring tools
- Web servers (server-based scripting)
An ActiveX scripting engine is basically the language to be executed on the ActiveX scripting host. The first ActiveX scripting engine is VBScript, a subset of the popular Visual Basic 4.0 development environment. However, ActiveX provides any number of potential script engine environments, such as the following:
An existing application that doesn't need to be embedded in a Web page can be converted to an ActiveX document. Documents that conform to the ActiveX standard can be opened within other ActiveX document containers including the following:
- Microsoft Internet Explorer 3.0
- Microsoft Office Binder
- Forthcoming new Windows shell
ActiveX documents are based upon a more general abstraction called DocObjects. The DocObjects technology is a set of extensions to OLE documents, the compound document technology of OLE. As with OLE documents, the DocObjects standard requires a container to provide the display space for a DocObject. This technology allows the browser to present documents from Office and Office Compatible applications. Such functionality might allow any kind of document to be displayed within the Web browser.
Recall the OLE convention that an embedded object is displayed within the page of its owner document. Embedded objects do not, however, control the page on which they appear. These types of objects are usually quite small and hold very little persistent data. A spreadsheet with a few columns and rows, for instance, might be included in a Word document.
ActiveX documents, on the other hand, provide a fully functional document space. ActiveX documents also control the page in which they appear (called a DocObject container). This means that ActiveX documents can be considerably more feature rich than the related embedded object.
One of the reasons for the rise of the Internet is the way that the Web has created an environment where every document is viewable in a single application. The ActiveX document standard aims to take those features another step beyond. ActiveX documents make the technology to use the Web as a vehicle for distribution of application specific documents. Microsoft's Internet Explorer 3.0 is an excellent example of an ActiveX document hosting engine.
The Internet ActiveX Control Pack (ICP) is not really ActiveX per se. ICP is, instead, an application of ActiveX. But don't let that stop you. With ICP, it's easy to integrate ActiveX controls into your Visual Basic programs. The ICP contains controls for most of the major Internet services you'll want to integrate into your own applications.
The Transmission Control Protocol (TCP) is the first of two principle methods for transmitting data over the Internet today. TCP is a connection oriented protocol most often used for transmitting Internet Protocol (IP) packets over a network. Connection oriented protocols like TCP are responsible for ensuring that a series of data packets sent over a network all arrive at the destination and are properly sequenced. That's why you'll frequently see the moniker "TCP/IP." The ActiveX TCP control allows you to easily handle TCP data packets in your applications without knowing much about the details of the TCP protocol.
The User Datagram Protocol (UDP) is the second of two principle methods for transmitting data over the Internet today. UDP is a connectionless protocol regularly used for transmitting Internet Protocol (IP) packets over a network. Unlike TCP and other connection oriented protocols, UDP doesn't care about the sequence of data packets. A UDP packet must stand on its own. The UDP control allows you to handle UDP data packets in your applications without knowing much about the details of the UDP protocol.
The File Transfer Protocol (FTP) is probably the second most popular application used on the Internet today. FTP allows Internet users to upload and download files across the network. FTP also provides a mechanism to obtain filename, directory name, attributes, and file size information. As with most Internet based applications, FTP employs the client/server paradigm. The FTP server responds to requests for files from an FTP client. You'll use the FTP client control when your applications need to transfer text and binary files from FTP servers somewhere on the network.
The HyperText Transfer Protocol (HTTP) is used by absolutely the most popular application on the Internet. HTTP governs the interaction between an HTTP server and the Web browser. The HTTP client control allows you to directly retrieve HTTP documents. You'll use the HTTP control to create applications like HTML browsers.
Programming Web content requires Hypertext Markup Language (HTML) programming. Typically, the job of a Web browser parses and renders the HTML. HTML describes the placement and size of text and graphics. You'll use the HTML control to parse and layout HTML data, as well as provide a scrollable view of the selected HTML page. Unfortunately, the HTML client control only supports HTML 2.0 and not the evolving HTML 3.0 standard. The HTML control lets you implement an HTML viewer, with or without automatic network retrieval of HTML documents, into any application.
Many users find e-mail to be a convenient and easy way to exchange personal and corporate information. Electronic mail finds its way over the Internet using the Simple Mail Transfer Protocol (SMTP). The SMTP client control sends Internet mail messages to SMTP servers. The SMTP control supports all SMTP commands used in sending out a mail message. So integrating e-mail directly into new and existing applications is easy.
E-mail is typically stored on the SMTP server and then distributed to the actual recipient via the Post Office Protocol (POP). The POP control provides access to Internet mail servers using the POP3 protocol. If your applications need to retrieve and delete messages from Internet mail servers, the POP client control makes it easy.
UseNet newsgroups are distributed over the Internet via the Network News Transmission Protocol (NNTP). The NNTP client control enables interaction with newsgroups on the Net. With this control, you'll connect to a news server, retrieve a list of available newsgroups and their descriptions, and view news messages. Newsgroups contain a wealth of information on an extremely diverse set of topics, so you may have many applications that require scanning of news group posts.
The ActiveX Server Framework provides an alternative to the Common Gateway Interface method of executing applications on a Web server and interacting with the Web browser dynamically. There are two major types of applications that can be developed using the ActiveX Server Framework:
- ISAPI applications
- ISAPI filters
Web servers spawn Common Gateway Interface applications in separate processes with a separate environment. The Internet Server Applications Programming Interface (ISAPI) specification provides an alternative to CGI programs with potentially higher performance type capabilities for the Microsoft Internet Information Server (IIS). ISAPI allows Web developers to build applications that execute in the same process space as the Web server (see fig. 2.1).
Fig. 17.1 - CGI and ISAPI have different approaches to use of process space.
Applications written using ISAPI should be faster simply because the operating system does not have to duplicate the environment and spawn a new process as is required by CGI.
ISAPI applications are actually Dynamic Link Libraries (DLLs). Note that operating in the server's process space carries higher risk while providing somewhat higher performance. Since the ISAPI application is loaded in the same process as the HTTP server, an access violation by the ISAPI application may crash the HTTP server.
The Internet Survey Application Programming Interface (ISAPI) also provides a mechanism for modifying the behavior of the server in specific ways. You'll employ ISAPI filters in cases where the default behavior of the server is inappropriate for the application. ISAPI filters can modify the behavior of the following server functions:
- Traffic Analysis
If you've been surfing the Web, you've probably come across Web sites with pages that require a user name and password. Web site managers may want to control access to Web pages for any number of reasons. For instance, you might want to sell subscriptions to valuable content on your Web site. By default, most Web servers provide a basic authentication scheme. Usually this is a simple user name and password verification step. With ISAPI, you can replace this basic authentication with a customized authentication process. Perhaps, your environment requires that all user names and passwords for all systems be verified with a centralized database (so called Single Sign On procedures). ISAPI filters provide a mechanism to accomplish this goal.
Sufficient bandwidth is perhaps the greatest inhibitor to complex content on the Internet. With an ISAPI filter, you can provide custom compression filters to improve throughput in high-end custom applications of Web technology.
Many believe that commerce, the buying and selling of goods and services, will largely take place over the Internet. Because commerce requires the exchange of information (such as credit card numbers) that creates a tasty target for hackers, encryption is a key enabling technology. Encryption may be important in other applications as well. For instance, a company may want to transmit sensitive data to customers or suppliers. Encryption protects the data while it is in transit from source to destination. You can implement encryption to protect your data using an ISAPI filter.
When a Web server services a request for a Web page, the server makes an entry in the access log file. The access log file indicates which Web page, CGI, or ISAPI application was accessed. If the user has authenticated via the Web servers built-in authentication, the access log also contains the user name in access record. Date, time, and some other information is also recorded in the log as well. One of the ways Web site operators make money is through advertising sales. Advertisers buy ad space based upon how many people will see their ad. So reporting information about how and by whom Web pages are accessed is extremely critical. You'll customize logging functionality using ISAPI filters.
You may want to handle requests for a specific URL differently. For instance, you might want to catch all http://www.yourhost.com/../../etc/passwd requests and handle them in a certain way. You might want to examine other details of the transactions between Web browsers and your server. You'll use ISAPI filters to engage in traffic analysis.
Copyright © 1996, Que Corporation
Technical support for our books and software is available by email from email@example.com
Copyright ©1996, Que Corporation. All rights reserved. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 West 103rd Street, Indianapolis, IN 46290.
Notice: This material is from BackOffice Intranet Kit, ISBN: 0-7897-0848-5. The electronic version of this material has not been through the final proof reading stage that the book goes through before being published in printed form. Some errors may exist here that are corrected before the book is published. This material is provided "as is" without any warranty of any kind.