Used to simplify reference counting for a COM interface pointer.
com
with-temp-interface (var) interface-ptr {form}* => value*
| var⇩ |
A symbol. |
| interface-ptr⇩ |
A form which is evaluated to yield a COM interface pointer. |
| form⇩ |
A form to be evaluated. |
| value* |
The values returned by the last form. |
The macro with-temp-interface evaluates each form with the variable var bound to the value of interface-ptr. When control leaves the body (whether directly or due to a non-local exit), release is called with this interface pointer.
This example invokes the COM method GetDocumentation in the interface ITypeInfo on an interface pointer which must be released after use.
(defun get-tinfo-member-documentation (disp tinfo
member-id)
(with-temp-interface (typeinfo)
(get-type-info disp tinfo)
(call-com-interface (typeinfo i-type-info
get-documentation)
member-id)))
COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:38