Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

INFO: Difference Between OLE Controls and ActiveX Controls


View products that 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 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 "OLE Object" 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 versus ActiveX controls in the October 1996 issue of the MIND (Microsoft Internet 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.

↑ Back to the top


More information

  1. 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. No one should use the term "OLE control" anymore.
  2. 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.
  3. 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 ActiveX controls. This excludes VBXs and Windows Custom Controls because they were never OLE-based to start with.
  4. 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 hosted in 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 and synchronously loading of properties, but they are still ActiveX controls. This is where most of the confusion comes in.
  5. 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 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 time and run time.

    The OLE control and Control Container Guidelines and other related specifications can be found in the Internet Client SDK documentation.
  6. Q. So, will all ActiveX controls work with Visual Basic 4.0?

    A. Most ActiveX controls should work with Visual Basic 5.0.
  7. 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 some ActiveX 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.
  8. 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 lightweight controls for use over the Internet or intranet.

↑ Back to the top


References

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

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 Technologies
For 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 5
For 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 Explorer
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top


Keywords: kbusage, kbinfo, kbfaq, KB159621

↑ Back to the top

Article Info
Article ID : 159621
Revision : 4
Created on : 5/11/2006
Published on : 5/11/2006
Exists online : False
Views : 557