Name
VarDispProc Variable
Syntax
var VarDispProc: Pointer; procedureInvoke(Result: PVariant; const Instance: Variant; CallDesc: PCallDesc; Params: Pointer); cdecl; VarDispProc := @Invoke;
Description
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.
Tips and Tricks
Do not assign
niltoVarDispProc. Unlike similar procedure pointers in Delphi, ifVarDispProcisnil, Delphi does not have a default behavior, and you get an access violation instead.The initial value of
VarDispProcpoints to a procedure that reports runtime error 17 (EVariantError).The
ComObjunit defines this procedure to handle all the details for you. It also declares thePCallDesctype.
See Also
| DispCallByIDProc Variable, Dispinterface Keyword, IDispatch Interface, Interface Keyword, OleVariant Type, Variant Type |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access