INFO: Difference Between OLE Controls and ActiveX Controls
This article was previously published under Q159621
This article has been archived. It is offered "as is" and will no longer be updated.
The specification for ActiveX controls has been relaxed to give developersthe ability to create smaller, faster controls that are more suitable forthe Internet. In the new object linking and embedding (OLE) control specification, we make use of component categories, which relax previous rules that identify interfaces as being mandatory and allow greater flexibility to efficiently target certain areas of functionality without having to provide superfluous support to qualify as a control. The OLE control specification also adds some new features such as windowless objects, URL monikers, asynchronous monikers, progressive downloading, and OLE Hyperlinks. Perhaps most importantly, you can mark controls as safe for data download and safe for scripting.
Keep in mind that an ActiveX control is just another term for an "OLEObject" or "Component Object Model (COM) Object." A "COM Object" must support the IUnknown interface. In addition, all ActiveX controls must be self-registering; as a result, an in-process control must implement and export 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 that the control creates and registers its class factory objects with the system when it is first run. Because IUnknown does not 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 confusing issue of OLE controls versusActiveX controls in the October 1996 issue of the MIND (MicrosoftInternet Developer) magazine.
For more information on enabling controls for the Internet, as well as which interfaces and functions an ActiveX control supports, see the "ActiveX Controls" section of the ActiveX SDK online documentation.
- Q. What is the difference between an OLE control and an ActiveX control?
A. No difference. "ActiveX control" renames and restructures 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 control" to distance the name from the older Object Linking and Embedding technology with which controls have very little in common. Noone should use the term "OLE control" anymore.
- Q. Is an OCX an "ActiveX control"?
A. No, an OCX is a file that can hold one or more ActiveX controls. These files do not need to have the .ocx extension (some are .dll files) 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.
- Q. Are out-of-the-box OLE controls (such as the one that shipped with Visual Basic 4.0) also ActiveX controls?
A. Yes, all controls that we formerly called "OLE controls" are ActiveXcontrols. This excludes VBXs and Windows Custom Controls because they werenever OLE-based to start with.
- Q. How about MFC controls? Are they also ActiveX controls?
A. Yes, all MFC controls are ActiveX controls. An old Visual C++ 4.0 control is an ActiveX control, as is one that is created with Visual Basic 4.0. View the term "ActiveX control" as a renaming and restructuring, an evolution of the OLE control technology.
A control can be built to work efficiently on the Internet, to be hostedin desktop container applications, or to do both. Sure, some controls are not as better suited to be used on the Internet due to their large size andsynchronously loading of properties, but they are still ActiveX controls.This is where most of the confusion comes in.
- Q. Are there different types of ActiveX controls?
A. 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 theregistry with the "Control" key and that implement the older OLE controlspecification, although they may be able to use newer controls asAutomation objects. Newer controls and containers can use something called"Component Categories" to describe the functionality that they export, aswell as the container support that they require to work 100 percentproperly in both design time and run time.
The OLE control and Control Container Guidelines and other relatedspecifications can be found in the Internet Client SDK documentation.
- Q. So, will all ActiveX controls work with Visual Basic 4.0?
A. Most ActiveX controls should work with Visual Basic 5.0.
- Q. Will all ActiveX controls work with Internet Explorer 3.0?
A. Internet Explorer is designed to host lightweight ActiveX controls,including support for windowless controls.
Internet Explorer also includes security features that may prevent someActiveX controls from working with all Internet Explorer 3.0 configurations. This is most likely for older controls. For controls to work smoothly with Internet Explorer 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, Internet Explorer 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.
- Q. How do "lightweight ActiveX controls" come into play?
A. 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.
You can use the Active Template Library (ATL) to create lightweightcontrols for use over the Internet or intranet.
If you want to know more about ActiveX controls, particularly on developingWeb pages, see another FAQ available on the Internet Client SDK Webpage.
For additional information on the ActiveX technologies, click the article number below to view the article in the Microsoft Knowledge Base:
154544 Description of ActiveX TechnologiesFor additional information on the ActiveX controls that are removed in Internet Explorer 5 and 5.5, click the article number below to view the article in the Microsoft Knowledge Base:
190045 INFO: ActiveX Controls That Are Removed from Internet Explorer 5For additional information on how to troubleshoot problems with ActiveX scripts and ActiveX controls in Internet Explorer, click the article number below to view the article in the Microsoft Knowledge Base:
154036 How to Disable Active Content in Internet ExplorerFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Article ID: 159621 - Last Review: 12/04/2015 15:48:08 - Revision: 4.0
Microsoft Internet Explorer 3.0, Microsoft Internet Explorer 4.0 128-Bit Edition, Microsoft Internet Explorer 4.01 Service Pack 2, Microsoft Internet Explorer 5.0, Microsoft Internet Explorer 5.01, Microsoft Internet Explorer 5.5, Microsoft Visual Basic 4.0 16-bit Enterprise Edition, Microsoft Visual Basic 4.0 32-Bit Enterprise Edition, Microsoft Visual FoxPro 3.0 Standard Edition, Microsoft Visual FoxPro 3.0b Standard Edition, Microsoft Visual FoxPro 5.0 Standard Edition, Microsoft Visual C++ 2.0 Professional Edition, Microsoft Visual C++ 2.1, Microsoft Visual C++ 2.2, Microsoft Visual C++ 4.0 Standard Edition, Microsoft Visual C++ 4.1 Subscription, Microsoft Visual C++ 4.2 Enterprise Edition, Microsoft Visual C++ 6.0 Enterprise Edition, Microsoft Visual C++ 4.2 Professional Edition, Microsoft Visual C++ 6.0 Professional Edition
- kbnosurvey kbarchive kbfaq kbinfo kbusage KB159621