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

NextPrevUpTopContentsIndex

with-com-object

Macro
Summary

Used to simplify invocation of several methods from a given COM object.

Package

com

Signature

with-com-object disp object form* => values

disp ::= (dispatch-function class-name &key interface)

Arguments

disp

The names of the dispatch function and object class.

dispatch-function

A symbol which will be defined as a macro, as if by macrolet. The macro can be used by the forms to invoke the methods on object.

class-name

A symbol which names the COM implementation class. It is not evaluated.

interface

An optional form which when evaluated should yield a COM interface pointer. This is only needed if the definition of the methods being called have the interface keyword in their class-specs.

object

A form which is evaluated to yield a COM object.

form

A form to be evaluated.

Values

values

The values returned by the last form.

Description

When the macro call-com-object evaluates the forms, the local macro dispatch-function can be used to invoked the methods for the COM class class-name, which should be the type or a supertype of the actual type of object.

The dispatch-function macro has the following signature:

dispatch-function method-spec arg* => values

method-spec ::= method-name | (interface-name method-name)

where

method-spec

Specifies the method to be called. It is not evaluated.

method-name

A symbol naming the method to call.

interface-name

A symbol naming the interface of the method to call. This is only required if the implementation class class-name has more than one method with the given method-name.

arg

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

values

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

Note that, because with-com-object requires a COM object, it can only be used by the implementation of that object. All other code should use with-com-interface with the appropriate COM interface pointer.

Example
(with-com-object (call-my-doc doc-impl) my-doc
  (call-my-doc move 0 0)
  (call-my-doc resize 100 200))
See also

call-com-object
define-com-method
with-com-interface


LispWorks COM/Automation User Guide and Reference Manual - 14 Feb 2015

NextPrevUpTopContentsIndex