Automation Topics
| Overview | How Do I | Sample |
Automation is available to both OLE and COM objects. For background, see the Overview. There are two categories of automation:
Automation (locally)
Remote Automation (over a network, using Distributed COM, or DCOM)
The remainder of this article concerns Automation. For Remote Automation, see the topic Remote Automation.
An Automation client is an application that can manipulate exposed objects belonging to another application. This is also called an Automation controller.
An Automation server is an application that exposes programmable objects to other applications. This is sometimes also called an “Automation component.”
The server application exposes Automation objects. These Automation objects have properties and methods as their external interface. Properties are named attributes of the Automation object. Properties are like the data members of a C++ class. Methods are functions that work on an Automation object. Methods are like the public member functions of a C++ class.
Note Properties can have member functions that access them. A Get/Set function pair typically accesses a property of the object.
Passing Parameters in Automation
One of the difficulties in creating Automation methods is providing a uniform “safe” mechanism to pass data between automation servers and clients. Automation uses the VARIANT type to pass data. The VARIANT type is a tagged union. It has a data member for the value (this is an anonymous C++ union) and a data member indicating the type of information stored in the union. The VARIANT type supports a number of standard data types: 2- and 4-byte integers, 4- and 8-byte floating point numbers, strings, and Boolean values. In addition, it supports the HRESULT (OLE error codes), CURRENCY (a fixed-point numeric type), and DATE (absolute date and time) types, as well as pointers to IUnknown and IDispatch interfaces.
The VARIANT type is encapsulated in the class. The supporting CURRENCY and DATE classes are encapsulated in the and classes.