VarDispProc Variable
var VarDispProc: Pointer; procedureInvoke
(Result: PVariant; const Instance: Variant; CallDesc: PCallDesc; Params: Pointer); cdecl; VarDispProc := @Invoke
;
VarDispProc
points to a procedure that invokes an
IDispatch
method from a Variant
reference. When a Variant
refers to a COM server,
it is actually storing an IDispatch
interface and
has the VarType
of varDispatch
.
When your program calls a method or uses a property of the COM
server, the Variant
object must call the
IDispatch.Invoke
method. Delphi relies on the
VarDispProc
procedure to do
this.
Result
is a pointer to a
Variant
where a function result should be stored,
or it is nil
if no result is expected.
Instance
is the Variant
that
contains the IDispatch
interface invoking the
method or property. CallDesc
points to a record
that describes the method to be invoked, and
Params
points to an array that describes the
method arguments.
Do not assign nil
to
VarDispProc
. Unlike similar procedure pointers in
Delphi, if VarDispProc
is nil
,
Delphi does not have a default behavior, and you get an access
violation instead.
The initial value of VarDispProc
points to a
procedure that reports runtime error 17
(EVariantError
).
The ComObj
unit defines this procedure to handle
all the details for you. It also declares the
PCallDesc
type.