An OLE Automation Object is an instance of a class within your application that you may wish to manipulate programmatically, such as with Cypress Enable. These may be new classes whose sole purpose is to collect and expose data and functions in a way that makes sense to your customers.
The object becomes programmable when you expose those member functions. OLE Automation defines two types of members that you may expose for an object:
Methods are member functions that perform an action on an object. For example, a Document object might provide a Save method.
Properties are member function pairs that set or return information about the state of an object. For example, a Drawing object might have a style property.
For example, Microsoft suggests the following objects could be exposed by implementing the listed methods and properties for each object:
OLE Automation object | Methods | Properties |
Application | Help | ActiveDocument |
Quit | Application | |
Add Data | Caption | |
Repeat | DefaultFilePath | |
Undo | Documents | |
Height | ||
Name | ||
Parent | ||
Path | ||
Printers | ||
StatusBar | ||
Top | ||
Value | ||
Visible | ||
Width |
Document | Activate | Application |
Close | Author | |
NewWindow | Comments | |
FullName | ||
PrintPreview | Keywords | |
RevertToSaved | Name | |
Save | Parent | |
SaveAs | Path | |
ReadOnly | ||
Saved | ||
Subject | ||
Title | ||
Value |
To provide access to more than one instance of an object, expose a collection object. A collection object manages other objects. All collection objects support iteration over the objects they manage. For example, Microsoft suggests an application with a multiple document interface (MDI) might expose a Documents collection object with the following methods and properties:
Collection Object | Methods | Properties |
Documents | Add | Application |
Close | Count | |
Item | Parent | |
Open |