Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework


Automation Object Method-Call Syntax



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə239/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   235   236   237   238   239   240   241   242   ...   294
DelphiLanguageGuide

Automation Object Method-Call Syntax
The syntax of an Automation object method call or property access is similar to that of a normal method call or
property access. Automation method calls, however, can use both positional and named parameters. (But some
Automation servers do not support named parameters.)
A positional parameter is simply an expression. A named parameter consists of a parameter identifier, followed by
the := symbol, followed by an expression. Positional parameters must precede any named parameters in a method
call. Named parameters can be specified in any order.
Some Automation servers allow you to omit parameters from a method call, accepting their default values. For
example,
     Word.FileSaveAs('test.doc');
     Word.FileSaveAs('test.doc', 6);
     Word.FileSaveAs('test.doc',,,'secret');
     Word.FileSaveAs('test.doc', Password := 'secret');
     Word.FileSaveAs(Password := 'secret', Name := 'test.doc');
Automation method call parameters can be of integer, real, string, Boolean, and variant types. A parameter is passed
by reference if the parameter expression consists only of a variable reference, and if the variable reference is of type
Byte, Smallint, Integer, Single, Double, Currency, TDateTime, AnsiString, WordBool, or Variant. If the expression is
not of one of these types, or if it is not just a variable, the parameter is passed by value. Passing a parameter by
reference to a method that expects a value parameter causes COM to fetch the value from the reference parameter.
Passing a parameter by value to a method that expects a reference parameter causes an error.
Dual Interfaces
A dual interface is an interface that supports both compile-time binding and runtime binding through Automation.
Dual interfaces must descend from IDispatch.
202


All methods of a dual interface (except from those inherited from 
IInterface
 and 
IDispatch
) must use the
safecall convention, and all method parameter and result types must be automatable. (The automatable types are
Byte, Currency, Real, Double, Real48, Integer, Single, Smallint, AnsiString, ShortString, TDateTime, Variant,
OleVariant, and WordBool.)
203



Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   235   236   237   238   239   240   241   242   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin