The macros call-com-interface and with-com-interface are used to call COM methods. To call a COM method, you need to specify the interface name, the method name, a COM interface pointer and suitable arguments. The interface and method names are given as symbols named as in The mapping from COM names to Lisp symbols and the COM interface pointer is a foreign pointer of type com-interface. In both macros, the arg s and value s are as specified in the Data conversion when calling COM methods.
The with-com-interface macro is useful when several methods are being called with the same COM interface pointer, because it establishes a local macro that takes just the method name and arguments.
For example, the following are equivalent ways of calling the
move
and
resize
methods of a COM interface pointer
window-ptr
for the
i-window
interface:
(progn
(call-com-interface (window-ptr i-window move) 10 10)
(call-com-interface (window-ptr i-window resize) 100 100))
(with-com-interface (call-window-ptr i-window) window-ptr
(call-window-ptr move 10 10)
(call-window-ptr resize 100 100))