Click to return to the Component Development home page    
Web Workshop  |  Component Development

ActiveX Controls Overview


Nancy Cluts
Developer Technology Engineer
Microsoft Corporation

Updated: October 23, 1998


Contents
What Is an "ActiveX Control"?
How to Start Writing ActiveX Controls

Also see the FAQ on developing Web pages using ActiveX controls.

What Is an "ActiveX Control"?

ActiveX controls, formerly known as OLE controls or OCX controls, are components (or objects) you can insert into a Web page or other application to reuse packaged functionality someone else programmed. For example, the ActiveX controls that are included with Microsoft® Internet Explorer version 3.0 or higher allow you to enhance your Web pages with sophisticated formatting features and animation.

A key advantage of ActiveX controls over Java applets and Netscape plug-ins is that ActiveX controls can also be used in applications written in many programming languages, including all of the Microsoft programming and database languages.

There are literally hundreds of ActiveX controls available today with functionality ranging from a timer control (which simply notifies its container at a particular time) to full-featured spreadsheets and word processors. If you can imagine it, you can do it with an ActiveX control.

You can add ActiveX controls to your Web pages by using the standard HTML <OBJECT> tag. The <OBJECT> tag includes a set of parameters that you use to specify which data the control should use and to control the appearance and behavior of the control.

Microsoft Internet Explorer (version 3.0 or higher) comes with a set of ActiveX controls that it uses. With some of these controls, you can:

The ActiveX controls that are provided with Internet Explorer are installed automatically when the user installs Internet Explorer 3.0 or higher. Once installed, ActiveX controls run automatically when a Web page containing them is displayed -- users do not need to download any additional files.

If you're a Web author, you can take advantage of the ready-to-use ActiveX controls written by some third-party companies. These controls can be found on MSDN's third-party software page at http://msdn.microsoft.com/developer/thirdparty/. If you're a programmer, you can write your own controls using Visual C++® and one of the ActiveX control frameworks: the Microsoft Foundation Class Library (MFC), the ActiveX Template Library (ATL), or the BaseCtl framework.

TopBack to top

How to Start Writing ActiveX Controls

ActiveX controls are OLE controls that have been extended for the Internet environment. See the table of contents listing (click the Show TOC button above) to find all of the information you need to create ActiveX controls.

There are three basic ways to write ActiveX controls today:

If you are already a proficient C/C++ OLE developer, the easiest method is probably to use the OLE control development facilities built into Visual C++ and MFC. This technology allows you to create control executables that are pretty small (so they download faster); however, it requires the correct MFC dynamic link library (DLL) to be installed on the user's system. This DLL is quite large--nearly a megabyte. But even so, it needs to be installed only once on each user's system and shouldn't take more than 10 minutes or so to download, even at 14.4 Kbps. The good news is that this DLL most likely already resides on your computer (or your user's computer) and will not need to be downloaded.

The Microsoft Internet Explorer developers included a sample called BaseCtl in the Workshop. This sample comprises the FrameWrk, ToDoSvr, and WebImage examples. Writing your controls in this style gives you the smallest possible controls; however, it also requires intimate knowledge of OLE Component Object Model (COM) and ActiveX control architecture--so it's not for the faint-of-heart.

Finally, the Visual C++ team has created the ActiveX Template Library (ATL) Non-MSDN Online link, which includes the library plus the Beeper and Labrador samples. This is a library of C++ templates that allows you to create very fast and small controls--in fact, you can even avoid linking in the C run-time library. The templates also do some of the grunge work of OLE for you, but they still require a pretty intimate knowledge of COM and ActiveX control architecture--so they're for those who aren't timid, but would like to have some of the tedious OLE work done for them.

Here are some good technical articles and samples (from the Workshop) that can help you through the process of learning about ActiveX controls:



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.