All Manuals > COM/Automation User Guide and Reference Manual > 1 Using COM

1.7 Querying for other COM interface pointers

An interface pointer can be queried to discover if the underlying object supports other interfaces. This is done using the function query-interface, passing the interface pointer and the refiid of the interface to query. A refiid is either a foreign pointer to a GUID structure or a symbol naming a COM interface as described in 1.3 The mapping from COM names to Lisp symbols.

For example, the function below will find the COM interface pointer for its i-dispatch interface:

(defun find-dispatch-pointer (ptr)
  (query-interface ptr 'i-dispatch))

The macro with-query-interface can be used to query an interface pointer and automatically release it again on exit from a body of code.


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