Name
DispCallByIDProc Variable
Syntax
var DispCallByIDProc: Pointer; type PDispRec = ^TDispRec; TCallDesc = packed record CallType: Byte; ArgCount: Byte; NamedArgCount: Byte; Args: array[0.255] of Byte; end; TDispDesc = packed record Dispid: Integer; ResultType: Byte; CallDesc: TCallDesc; end; procedureCallProc
(Result: Pointer; const Dispatch: IDispatch; DispDesc: PDispDesc; Params: Pointer); cdecl; DispCallByIDProc := @CallProc
;
Description
Delphi
calls the DispCallByIDProc
procedure to call a
dispatch method that is identified by dispatch identifier in a
dispinterface
. Delphi fills the
DispDesc
record with the necessary information
about the dispatch identifier and the method’s formal
parameters. Params
points to the actual arguments
for the method call. The procedure must store the result in the
memory buffer pointed to by Result
. The type of
Result
’s buffer is dictated by the dispatch
descriptor.
The default value of DispCallByIDProc
is a
procedure that raises runtime error 17
(EVariantError
).
Tips and Tricks
The
ComObj
unit setsDispCallByIDProc
to a procedure that implements the necessary code to callIDispatch.Invoke
.ComObj
also declares theTCallDesc
andTDispDesc
types.Writing your own
DispCallByIDProc
is a major undertaking. Consult the ComObj.pas source code to learn how.
See Also
Cdecl Directive, Dispid Directive, Dispinterface Keyword, IDispatch Interface, VarDispProc Variable |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.