ActiveX


Introduction

The World Wide Web is now more than just an experience of browsing through static pages. ActiveX technology has brought interactive objects such as animation, audio, video and virtual reality together on the Web. Web sites can now include user control and choice, which means they can behave like traditional software applications and are delivered on demand. The Web will have a more direct impact on people's lives and work, and will transform the way people use the Internet due to these exciting changes in technology.


What is COM?

COM (Component Object Model) is a framework for creating and using components. It provides the widest choice in services, tools, languages and applications. It also makes software easier to write and reuse. Some features of COM are that you can use any programming language and there is flexible security. Also, it is integrated with Development Tools, there are mature specification and reference implementation, and its services used in a standard way, regardless of location.


The Evolution of ActiveX

When Microsoft released OLE 2.0 in 1993, it was the first technology to be based or built upon COM. Under OLE, the operating system provided a common support structure for all applications that use the OLE controls and functionality. This gives a more standardized object model for both application developers and users. OLE Controls allow the creation of functions within a document that act as if they were programs running inside the document itself. Since then, components such as automation, controls and compound documents are now called ActiveX. ActiveX includes both client and server technologies.


What is ActiveX?

ActiveX is a set of technologies from Microsoft that enables interactive content for the World Wide Web, which is based on COM. It is not a programming language, but a set of rules for how applications should share information. ActiveX makes it easy to integrate and reuse any components such as HTML documents, Java Applets, Java Script and more. For Intranet developers, ActiveX provides core functionality for building reliable enterprise-wide applications offering enhanced productivity beyond basic HTML document sharing. ActiveX has a powerful combination of innovation and productivity of interactive programming, along with ubiquity and standardization of the Internet. Before ActiveX, Web content was static, 2-dimensional text and graphics. With ActiveX, Web sites come alive using multimedia effects, interactive objects, and sophisticated applications. It allows Web producers to use the most imaginative work from the software development community and make it available to the widest possible audience. ActiveX creates engaging and appealing web experiences for users. It is also a means of immediate availability of thousands of useful building blocks that can be incorporated into Web pages for web designers. It enables developers with varied backgrounds and expertise to bring creativity to the Web because it is supported by many different languages and tools. ActiveX is important because it allows developers and Web producers to create unique and interactive Web sites quickly and easily. This in turn will make the Internet more useful and productive.


Elements of ActiveX

The three main elements of ActiveX are ActiveX Controls, ActiveX Scripting and ActiveX Documents.

ActiveX Controls
ActiveX Controls are interactive objects in a Web page that provide user-controllable functions and are manipulated visually by GUI development tools. They provide tools for linking desktop applications to the World Wide Web and are also programmable by other components and scripts. ActiveX Controls can reside locally on a client machine or they can be downloaded from the Internet. They can also be used to handle client-side interactions with the user. ActiveX Controls may be as simple as a button or as complex as a reporting tool. They are the third version of OLE controls (OCX), providing a number of enhancements specifically designed to facilitate distribution of components over high-latency networks and to provide integration of controls into Web browsers. These enhancements include features such as incremental rendering and code signing, to allow users to identify the authors of controls before allowing them to execute. ActiveX controls communicate through the low-level DCOM mechanism that allows controls to access each other's exposed methods, regardless of whether the controls reside in the same container, in the same machine, or on different machines. These controls are linked through events; the development environment allows developers to create methods that are called when events are initiated by any components being used.

ActiveX Scripting
ActiveX Scripting is used as a medium to initialize and manipulate the various elements on an HTML page, including forms, Java applets, and ActiveX controls from the browser or server. The currently available ActiveX Scripting languages are VBScript and JavaScript (default script). These scripting languages use OLE Automation to communicate with an ActiveX Control; the ActiveX Control fires OLE events that can be handled in the ActiveX Script code in response to user interactions (such as clicking on a button in the ActiveX control).

ActiveX Documents
An ActiveX document is a structured storage file that is displayed by an ActiveX component, that enable users to view non-HTML documents, such as Microsoft Excel or Word files, through a Web browser. But you do need these programs installed on the machine. Also, existing documents can be published on the Internet site without having to resave them in HTML format. Users are provided with a consistent interface since they are allowed to navigate, view and edit the contents of documents that can not be render using HTML alone. Some features of ActiveX Documents are that they use the entire client area, they provide printing support and have menu merging and toolbars, as well as they integrate existing documents into the browser or any other application.


ActiveX vs. Java

ActiveX has some advantages over Java. ActiveX controls are similar to Java applets. However, ActiveX controls have full access to the Windows operating system, which gives them much more power than Java applets. Also, the controls you download are saved to your hard drive every time you visit a different web page. Java, on the other hand, requires you to download a Java applet each time you visit a page because applets are not cached. Also, Java applets are limited in function since they cannot interact with a user's machine outside of a specified "sandbox", which is a barrier between the applet and the rest of the user's computer. Applets cannot write to your hard drive or start-up an application residing on your machine. Yet, this disadvantage means that critical areas such as the file system or the boot sector are strictly off-limits since Java applications are in a protected memory area. Theoretically, this makes it impossible for applets built in Java to damage a computer or its contents. It also walls applets off from working with other applications or piggybacking on system services, and it forces users to download an applet every time they want to use it. Java also provides cross platform support and is more secure.


How to Use ActiveX Controls in Web Pages

Embedding ActiveX controls
The process of embedding ActiveX controls into a web page is very similar to the way Java applets are embedded. The following example shows the HTML code used to embed an ActiveX control. The tag creates the ActiveX object. The tag has 5 attributes:

The tags let you specify the parameters of the ActiveX control. ActiveX controls expose a set of properties that affect how it operates and displays. The tag has two attributes:

Using ActiveX with scripting languages

ActiveX components may contain functions that can be called with JavaScript.

For example, the ActiveX control with ID="CDplayer" may contain a function playTrack(). You can call this function with JavaScript with the command "CDplayer.playTrack();"

ActiveX components may also generate events. These events can be trapped by writing script functions in the HTML page. ActiveX events can only be trapped by VBScript code.

For example, suppose the "AreaMenu" control shows a menu that the user can click on. When the user clicks on a menu item, the Click(index) event is generated. This event can be trapped by writing the following VBScript function in the body of the HTML page:


Example of ActiveX control and HTML

Here is an example of a web page with an embedded ActiveX control. The control opens the Microsoft NetMeeting application inside the browser window.


Here is the HTML code to generate this page:


Advantages of ActiveX

  • ActiveX allows the creation of web pages having active content with impact that will attract and retain users.

  • ActiveX components can be created using a wide assortment of tools and programming languages, including Visual Basic, Visual C++, Borland Delphi, Borland C++, Java, and Java-enabled tools. Developers can use what they know and be productive immediately.

  • There is an existing inventory of ActiveX controls available today for immediate use.

  • ActiveX components are automatically downloaded from the specified server when the page is opened. If the ActiveX control has already been downloaded and the version of the control is the same as the one specified in the web page, it does not need to be downloaded again. This offers an advantage over Netscape plug-ins, which need to be downloaded by the user before they can be used.

  • ActiveX controls can be re-used in other applications, or can be used to create new controls with extended functionality.


    Disadvantages of ActiveX

    ActiveX is not very compatible. It is currently only supported on Intel architectures. It is only supported in Internet Explorer (version 3.0 and above), although it can be used in Netscape indirectly using a third party plug-in for ActiveX from NCompass Labs called Scriptactive. Although ActiveX components can be currently run only on Windows, Microsoft is working on an implementation for the Macintosh and Unix.

    Security is a major disadvantage with ActiveX controls. ActiveX has no restrictions to prevent controls from using resources on the user's computer. This allows ActiveX controls to write to the local hard disk, potentially even wiping out all of a user's data. The only security provided at this time is in the form of a digital certificate of authenticity. When the user downloads an ActiveX control a certificate is presented which informs the user of the author of the control and other information. The user then has the option to cancel or continue with the downloading process. If the control does not have a certificate a warning is produced.


    Conclusion

    ActiveX provides web developers with many new exciting alternatives when designing web pages. ActiveX controls can bring new functionality to web pages not possible with previous technologies. This technology, however, does have the major disadvantage of security. ActiveX controls are not protected from using the user's computer's resources, and can write to the local hard disk. This is why ActiveX controls have not gained significant popularity on Web pages. One area where ActiveX controls have been used successfully is in company Intranets, where security is not an issue. In the future, the security of ActiveX controls will likely improve and the popularity of ActiveX controls will increase.