NextPrevUpTopContentsIndex

with-com-interface

Macro
Summary

Used to simplify invocation of several methods from a particular COM interface pointer.

Package

com

Signature

with-com-interface disp interface-ptr form * => values

disp ::= ( dispatch-function interface-name )

Arguments

disp

The names of the dispatch function and interface.

dispatch-function

A symbol which will be defined as a local macro, as if by macrolet . The macro can be used by the form s to invoke the methods on interface-ptr .

interface-name

A symbol which names the COM interface. It is not evaluated.

interface-ptr

A form which is evaluated to yield a COM interface pointer that implements interface-name .

form

A form to be evaluated.

Values

values

The values returned by the last form .

Description

When the macro with-com-interface evaluates the form s, the local macro dispatch-function can be used to invoked the methods for the COM interface interface-name , which should be the type or a supertype of the actual type of interface-ptr .

The dispatch-function macro has the following signature:

dispatch-function method-name arg * => values

where

method-name

A symbol which names the method. It is not evaluated.

arg

Arguments to the method (see Data conversion when calling COM methods for details).

values

Values from the method (see Data conversion when calling COM methods for details).

Example

This example invokes the COM method GetTypeInfo in the interface IDispatch .

(defun get-type-info (disp tinfo &key
                      (locale LOCALE_SYSTEM_DEFAULT))
  (multiple-value-bind (hres typeinfo)
      (with-com-interface (call-disp i-dispatch) disp
        (call-disp get-type-info tinfo locale))
    (check-hresult hres 'get-type-info)
    typeinfo))
See also

call-com-interface


LispWorks COM/Automation User Guide and Reference Manual - 23 Mar 2005

NextPrevUpTopContentsIndex