3.3.5 Using connection points

Event sink interfaces can be connected and disconnected using the functions interface-connect and interface-disconnect.

For example, the following macro connects a sink interface pointer event-handler to a source of i-clonable-events events clonable for the duration of its body.

(defmacro handling-clonable-events ((clonable event-handler)
                                    &body body)
  (lw:with-unique-names (cookie)
    (lw:rebinding (clonable event-handler)
      `(let ((,cookie nil))
               (setq ,cookie
                     (interface-connect ,clonable
           (when ,cookie
             (interface-disconnect ,clonable

LispWorks COM/Automation User Guide and Reference Manual - 21 Feb 2008