All Manuals > COM/Automation User Guide and Reference Manual > 4 Automation Reference Entries

with-dispatch-interface Macro

Summary

Used to simplify invocation of several methods from a particular Automation interface pointer.

Package

com

Signature

with-dispatch-interface disp dispinterface-ptr {form}* => value*

disp ::= (dispatch-function dispinterface-name)

Arguments
disp
The names of the dispatch function and Automation interface.
dispinterface-ptr
A form which is evaluated to yield a COM i-dispatch interface pointer.
form
A form to be evaluated.
dispatch-function
A symbol which will be defined as a macro, as if by macrolet. The macro can be used by forms to invoke the methods on dispinterface-ptr.
dispinterface-name
A symbol which names the Automation interface. It is not evaluated.
Values
value*
The values returned by the last form.
Description

When the macro with-dispatch-interface evaluates forms, the local macro dispatch-function can be used to invoked the methods for the Automation interface dispinterface-name, which should be the type or a supertype of the actual type of the Automation interface pointer dispinterface-ptr.

dispatch-function has the following signature:

dispatch-function method-name arg* => values

where:

method-name
A symbol which names the method. It is not evaluated.
arg
Arguments to the method (see 3.3.3 Data conversion when calling Automation methods for details).
values
Values from the method (see 3.3.3 Data conversion when calling Automation methods for details).
Examples

For example, in order to invoke the ReFormat method of a MyDocument interface pointer:

(with-dispatch-interface (call-doc my-document) doc
  (call-doc re-format))
See also

call-dispatch-method


COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:41