Automation object method calls are bound at runtime and require no previous method declarations. The validity of these calls is not checked at compile time.
The following example illustrates Automation method calls. The CreateOleObject function (defined in ComObj) returns an IDispatch reference to an Automation object and is assignment-compatible with the variant Word.
Word: Variant; begin
Word := CreateOleObject('Word.Basic'); Word.FileNew('Normal');
Word.Insert('This is the first line'#13); Word.Insert('This is the second line'#13); Word.FileSaveAs('c:\temp\test.txt', 3); end;
You can pass interface-type parameters to Automation methods.
Variant arrays with an element type of varByte are the preferred method of passing binary data between Automation controllers and servers. Such arrays are subject to no translation of their data, and can be efficiently accessed using the VarArrayLock and VarArrayUnlock routines.
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.