INFO: Difference Between OLE Controls and ActiveX Controls

ID: Q159621


The information in this article applies to:


SUMMARY

The specification for ActiveX controls has been relaxed to give developers the ability to create smaller, faster controls that are more suitable for the Internet. In the new OLE control specification, we make use of component categories, which allows the relaxing of some previous rules identifying interfaces as being mandatory and allows greater flexibility to efficiently target certain areas of functionality without having to provide superfluous support to qualify as a control. We also added some new features like windowless objects, URL monikers, asynchronous monikers, progressive downloading, and OLE Hyperlinks. (And, perhaps most importantly, we support marking controls as safe for data download and safe for scripting.)

Keep in mind that an ActiveX control is just another term for an "OLE Object" or "COM Object." A "COM Object" is required to support the IUnknown interface. In addition, all ActiveX controls must be self-registering. For an in-process control that means implementing and exporting DllRegisterServer and DllUnregisterServer. With NT 4.0 built-in marshaling support for the connection point interfaces, a control can now be a local server. This means creating and registering its class factory objects with the system when it is first run. Since IUnknown doesn't allow you to do much, you want to implement at least one additional interface. However, these minimal requirements allow controls to be as lightweight as possible.

Mike McKeown addresses this very confused issue of OLE Controls versus ActiveX Controls in the October 1996 issue of the MIND (Microsoft Internet Developer) magazine.

More information on enabling controls for the Internet, as well as various documentation on interfaces and functions an ActiveX Control should support, can be found on the "ActiveX Controls" section of the ActiveX SDK online documentation.


MORE INFORMATION

What is the difference between an OLE Control and an ActiveX Control?

No difference. Look at ActiveX Control as a renaming and restructuring of the OLE Controls technology. For marketing reasons the term OLE has come full circle and once again refers to the OLE technologies that apply to Object Linking and Embedding only. The term "OLE" control has been replaced with the "ActiveX" term to distance the name from the older Object Linking and Embedding technology with which controls have very little in common. No one should use the term "OLE Control" anymore.

Is an OCX an "ActiveX Control"?

No. An OCX is a file that can hold one or more Active Controls. These files do not need to have the .OCX extension (some use .DLL) and thus should not be referred to as "OCXs". This also links them to a file extension which is what our document-centric paradigm is trying to eliminate.

Are out of the box OLE Controls such as the one shipped with Visual Basic 4.0 also ActiveX controls?

Yes. All controls that we formerly called "OLE Controls" are ActiveX Controls. This excludes VBXs and Windows Custom Controls since they were never OLE based to start with.

How about MFC Controls, are they also ActiveX Controls?

Yes, all MFC Controls are ActiveX Controls. An old Visual C++ 4.0 Control is an ActiveX Control, as is one created with Visual Basic 4.0. Look at the term ActiveX Control as a renaming and restructuring of the OLE Control technology--an evolution.

A control can be built to work efficiently on the Internet, or to be hosted in desktop container apps, or to do both. Sure, some controls are not as better suited to be used on the Internet due to their large size and synchronously loading of properties, but they are still ActiveX Controls. This is where most of the confusion comes in.

Are there different types of ActiveX Controls?

Yes. The OLE Control and Control Container Guidelines version 2.0 describe a number of optional features that may be implemented. Some controls implement features that require corresponding features in the container in order to work properly. Conversely, some containers only recognize controls that implement some optional features.

Older containers typically only recognize controls that are marked in the registry with the "Control" key and that implement the older OLE Control specification, although they may be able to use newer controls as Automation objects. Newer controls and containers can use something called "Component Categories" to describe the functionality that they export as well as the container support that they require to work 100 percent properly in both design and run times.

The OLE Control and Control Container Guidelines and other related specifications can be found in the Internet Client SDK documentation.

So, will all ActiveX Controls work with Visual Basic 4.0?

Most ActiveX Controls should work with VB5.

Will all ActiveX Controls work with Internet Explorer 3.0 (IE3)?

Internet Explorer is designed to host lightweight ActiveX controls, including support for windowless controls.

Internet Explorer also includes security features that may prevent some ActiveX Controls from working with all IE3 configurations. This is most likely for older controls. In order for controls to work smoothly with IE when it is configured for the "High Safety Level" for active-content security (which is the default), the controls must be marked as "safe for initialization" or "safe for scripting." If a control is used on an HTML page in a way that conflicts with its safety identification and the user's safety level, IE does not create an instance of the control. See the Component Development - Safe Initialization and Scripting for ActiveX controls in the Internet Client SDK documentation for more information.

How do "lightweight ActiveX Controls" come into play?

Typically, when someone uses this term, they are referring to controls that are written to be as small as possible, so they can be downloaded quickly. Lightweight controls are ActiveX Controls, but may not implement all the required features of the older OLE Control specification.

The Active Template Library (ATL) can be used to create lightweight controls for use over the Internet or intranet.

If you want to know more about ActiveX controls, particularly on developing Web pages, check out another FAQ available on the Internet Client SDK Web page.

For a description of the ActiveX technologies, please see the following article in the Microsoft Knowledge Base:

Q154544 Description of ActiveX Technologies
For more information, please see the MSDN Web Workshop:
http://msdn.microsoft.com/workshop/default.asp

Additional query words:


Keywords          : kbusage kbIE300 kbIE400 kbIE401 kbDSupport AXSDKControls 
Version           : WINDOWS:3.0,3.0b,4.0,4.01,5.0; winnt:2.0,2.1,2.2,4.0,4.1,4.2,6.0
Platform          : WINDOWS winnt 
Issue type        : kbinfo 

Last Reviewed: July 23, 1999