Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

What Is an ActiveX Control?

Now that you know a little of the history behind ActiveX controls, this section explores just what an ActiveX control is. An ActiveX control is an embeddable COM object that is implemented as an in-process server DLL. It supports in-place activation as an inside-out activated object. Objects that are activated inside-out become user interface active with a single mouse click, instead of the double-click required for OLE or Active document embedded objects.

As an in-process object, an ActiveX control is loaded into the address space of its container. As you probably are aware, most Win32 processes have a virtual 4GB address space. (The Datacenter version of Windows 2000 has a much larger address space.)

The lower 2GB is where the application is loaded, and the upper 2GB is reserved for use by the operating system. An ActiveX control is loaded in the lower 2GB with the application. Therefore, the control shares the same resources with the application; hence the term in-process.

An ActiveX control is also a server that establishes two-way communication between the control and its container. It also can respond to user-initiated events, such as mouse movements, keyboard input, and programmatic scripting input—and it can pass that input to the container application for action.

ActiveX controls also are in-place activated. This means they can be placed in the active state by the user or the container and edited or manipulated. This is a functionality ActiveX controls inherit from OLE documents. Like a DLL, the ActiveX control is a library of functions. In fact, an ActiveX control can be considered a "super DLL." More than just a "super DLL," an ActiveX control is a detached object that can fire and respond to events, process messages, contain unique properties, and possess multithreaded capabilities. ActiveX controls also are known as OCXs because of their most common file extension, but they are actually DLLs. OCXs can contain several controls.

An ActiveX control can have its own data set and can act as an automation server, enabling you to manipulate its properties and methods. ActiveX controls can be 16 and 32 bit as well as Unicode. ActiveX controls can have properties set at both compile time and runtime, and ActiveX controls have methods that can perform certain operations.

ActiveX controls cannot be executed without an ActiveX container. You can use ActiveX controls in a wide variety of development tools, such as Delphi, Visual C++, Borland C++, Visual Basic, and PowerBuilder. You also can use ActiveX controls in a variety of environments not traditionally associated with programming, such as Microsoft Word, Microsoft Excel, Lotus, Hypertext Markup Language (HTML), and Internet Explorer.

Share ThisShare This

Informit Network