Used to simplify reference counting when querying a COM interface pointer.
com
with-query-interface disp interface-ptr {form}* => value*
disp ::= (punknown interface-name &key errorp dispatch)
interface-ptr⇩ |
A form which is evaluated to yield a COM interface pointer to query. |
form⇩ |
A form to be evaluated. |
punknown⇩ |
A symbol. |
interface-name⇩ |
A symbol which names the COM interface. It is not evaluated. |
errorp⇩ |
A generalized boolean. |
dispatch⇩ |
A symbol. |
value* |
The values returned by the last form. |
The macro with-query-interface
calls query-interface to find an interface pointer for interface-name from the existing COM interface pointer interface-ptr. It evaluates each form with the variable punknown bound to the queried pointer and the pointer is released when control leaves the body (whether directly or due to a non-local exit).
If errorp is true, then punknown is bound to nil
if the interface pointer cannot be found, otherwise an error of type com-error is signaled.
If dispatch is non-nil, then a local macro named by dispatch is created as if by with-com-interface to invoke COM interface methods on punknown.
This example invokes the methods on an i-bar
interface pointer queried from an existing interface pointer.
(with-query-interface (p-bar i-bar :dispatch call-bar) p-foo (call-bar bar-init) (call-bar bar-print))
COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:38