Automation Objects (Win32 Only) An object whose class implements the IDispatch interface (declared in the
System
unit) is an Automation object.
Use variants to access Automation objects. When a variant references an Automation object, you can call the object's
methods and read or write to its properties through the variant. To do this, you must include
ComObj
in the uses
clause of one of your units or your program or library.
Dispatch Interface Types Dispatch interface types define the methods and properties that an Automation object implements through IDispatch.
Calls to methods of a dispatch interface are routed through IDispatch's Invoke method at runtime; a class cannot
implement a dispatch interface.
A dispatch interface type declaration has the form
type interfaceName = dispinterface
['{GUID}']
memberList
end;
where ['{GUID}'] is optional and memberList consists of property and method declarations. Dispatch interface
declarations are similar to regular interface declarations, but they cannot specify an ancestor. For example,
type
IStringsDisp = dispinterface
['{EE05DFE2-5549-11D0-9EA9-0020AF3D82DA}']
property ControlDefault[Index: Integer]: OleVariant dispid 0; default;
function Count: Integer; dispid 1;
property Item[Index: Integer]: OleVariant dispid 2;
procedure Remove(Index: Integer); dispid 3;
procedure Clear; dispid 4;
function Add(Item: OleVariant): Integer; dispid 5;
function _NewEnum: IUnknown; dispid -4;
end;