Used to simplify invocation of several methods from a particular COM interface pointer.
com
with-com-interface disp interface-ptr {form}* => values
disp ::= (dispatch-function interface-name)
| disp |
The names of the dispatch function and interface. |
| interface-ptr⇩ |
A form which is evaluated to yield a COM interface pointer that implements interface-name. |
| form⇩ |
A form to be evaluated. |
| dispatch-function⇩ |
A symbol. |
| interface-name⇩ |
A symbol which names the COM interface. It is not evaluated. |
| values⇩ |
The values returned by the last form. |
The macro with-com-interface evaluates each form in a lexical environment where dispatch-function is defined as a local macro.
dispatch-function can be used to invoked the methods on interface-ptr for the COM interface interface-name, which should be the type or a supertype of the actual type of interface-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 1.8.1 Data conversion when calling COM methods for details). |
|
Values from the method (see 1.8.1 Data conversion when calling COM methods for details). |
This example invokes the COM method GetTypeInfo in the interface IDispatch.
(defun get-type-info (disp tinfo &key
(locale LOCALE_SYSTEM_DEFAULT))
(multiple-value-bind (hres typeinfo)
(with-com-interface (call-disp i-dispatch) disp
(call-disp get-type-info tinfo locale))
(check-hresult hres 'get-type-info)
typeinfo))
COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:38