World Library  
Flag as Inappropriate
Email this Article

OLE Automation

Article Id: WHEBN0004545603
Reproduction Date:

Title: OLE Automation  
Author: World Heritage Encyclopedia
Language: English
Subject: Component Object Model, Visual Basic for Applications, ActiveX, .NET Framework, LotusScript
Publisher: World Heritage Encyclopedia

OLE Automation

In Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation[1][2]) is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for use by scripting languages – originally Visual Basic – but now are used by several languages on Windows. All automation objects are required to implement the IDispatch interface. It provides an infrastructure whereby applications called automation controllers can access and manipulate (i.e. set properties of or call methods on) shared automation objects that are exported by other applications. It supersedes Dynamic Data Exchange (DDE), an older mechanism for applications to control one another.[3] As with DDE, in OLE Automation the automation controller is the "client" and the application exporting the automation objects is the "server".

Contrary to its name, automation objects do not necessarily use Microsoft OLE, although some of Automation objects can be used in OLE environments. The confusion has its roots in Microsoft's earlier definition of OLE, which was previously more or less a synonym of COM.

Advantages and limitations

To ensure interoperability, automation interfaces are limited to use a subset of all COM types.[4][5] Specifically, automation interfaces must use SAFEARRAY instead of raw COM arrays.

Automation-compatible COM servers can, however, rely on the in-built OLE marshalling implementation.[6] This avoids the need for additional proxy/stub projects for marshalling out-of-process.


Automation was designed with the ease of scripting in mind, so controllers often provide languages such as Visual Basic for Applications to end users, allowing them to control automation objects via scripts. Automation objects are often written in conventional languages such as C++,[7] where C++ attributes can be used to simplify development,[8] Languages such as Visual Basic and Borland Delphi also provides a convenient syntax for Automation which hides the complexity of the underlying implementation.

Type libraries

In order to automate an application, the developer of an automation controller must know the object model that is employed by the target application exporting activation objects.[9] This requires that the developer of the target application publicly document its object model. Development of automation controllers without knowledge of the target application's object model is "difficult to impossible".[10] Because of these complications, Automation components are usually provided with type libraries, which contain metadata about classes, interfaces and other features exposed by an object library. Interfaces are described in Microsoft Interface Definition Language. Type libraries can be viewed using various tools, such as the Microsoft OLE/COM Object Viewer (oleview.exe, part of the Microsoft Platform SDK) or the Object Browser in Visual Basic (up to version 6) and Visual Studio .NET. Type libraries are used to generate Proxy pattern/stub code for interoperating between COM and other platforms, such as Microsoft .NET and Java. For instance, the .NET Framework SDK includes tools that can generate a proxy .NET DLL to access Automation objects using both early binding (with information about interfaces extracted from a type library) and late binding (via IDispatch, mapped to the .NET Reflection API), with the built-in .NET-to-COM bridge called COM Interop.[11] While Java lacks built-in COM support, toolsets like JACOB[12] and jSegue[13] can generate proxy source code (consisting of two parts, a set of Java classes and a C++ source for a Java Native Interface DLL) from type libraries. These solutions only work on Windows. Another Java based j-Interop[14] library which enables interoperability with COM components without JNI,[15] using DCOM wire protocol (MSRPC) and works on non-Windows platforms also.

Microsoft has publicly documented the object model of all of the applications in Microsoft Office,[16] and some other software developers have also documented the object models of their applications. Object models are presented to automation controllers as type libraries, with their interfaces described in ODL.

Language support

Automation is available for a variety of languages, including, but not limited to:

See also


  1. ^ Microsoft Corporation. "Automation (MFC)".  
  2. ^ Kruglinski, David J.; Wingo, Scott; Shepherd, George (1998). "Chapter 25: Automation". Programming Microsoft Visual C++ 6.0 (5th ed.). Redmond, WA:  
  3. ^ Gordon McComb (1997). "Using OLE Automation to Control WordPerfect".  — McComb describes how to use OLE Automation instead of DDE to control WordPerfect
  4. ^ Microsoft MSDN: oleautomation attribute
  5. ^ Microsoft MSDN: Automation-Compatible Types
  6. ^ Microsoft MSDN: Marshaling Details (COM) Type Library Marshaling community additions
  7. ^ Chris Oakley. "OLE Automation for C++ programmers". 
  8. ^ MSDN Magazine: C++ Attributes: Make COM Programming a Breeze with New Feature in Visual Studio .NET
  9. ^ a b Yehuda Shiran and Tomer Shiran. "OLE Automation in JavaScript". WebReference.  — despite the title, the article discusses JScript rather than JavaScript
  10. ^ Bruce Armstrong (2006-01-16). "OLE — Extending the Capabilities of PowerBuilder (Part 2)". PowerBuilder Developers' Journal 12 (11). 
  11. ^ a b Appleman, Dan (2001). "Chapter 15: COM Interop and Accessing the Win32 API". Moving to VB.NET: Strategies, Concepts, and Code.  
  12. ^ "The JACOB Project". 2004-10-17. 
  13. ^ "jSegue". 2005-12-14. 
  14. ^ "j-Interop Java COM interoperability from any platform". 
  15. ^  
  16. ^ "How to find and use Office object model documentation". KnowledgeBase. Microsoft Corporation. 
  17. ^ "Compiler COM Support". MSDN. Microsoft. 
  18. ^ "OLE Automation using Delphi".  
  19. ^ "Open Object Rexx". 
  20. ^ Jan Dubois (Summer 1998). "Win32::OLE". The Perl Journal 3 (2). 
  21. ^ The PHP Group (2006-07-25). "PHP: COM and .Net (Windows)". 
  22. ^ Mark Hammond. "Python for Windows Extensions". 
  23. ^ Sourceforge. "Comtypes Python package". 
  24. ^ Tcl programmers. "OLE from a Tcl perspective". 

External links

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.