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

with-temp-interface Macro

Summary

Used to simplify reference counting for a COM interface pointer.

Package

com

Signature

with-temp-interface (var) interface-ptr {form}* => value*

Arguments
var
A symbol.
interface-ptr
A form which is evaluated to yield a COM interface pointer.
form
A form to be evaluated.
Values
value*
The values returned by the last form.
Description

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.

Examples

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)))
See also

release
with-query-interface


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