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

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.
object
A form which is evaluated to yield a COM object.
form
A form to be evaluated.
dispatch-function
A symbol.
class-name
A symbol which names the COM implementation class. It is not evaluated.
interface
A form.
Values
values
The values returned by the last form.
Description

The macro with-com-object evaluates each form in a lexical environment where dispatch-function is defined as a local macro.

dispatch-function can be used to invoked the methods on object for the COM class class-name, which should be the type or a supertype of the actual type of object.

dispatch-function 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 1.10.1 Data conversion when calling COM object methods for details).
values
Values from the method (see 1.10.1 Data conversion when calling COM object methods for details).

If interface is supplied, it should be a form that, when evaluated, yields a COM interface pointer. This is only needed if the definition of the method being called has the :interface keyword in its class-spec.

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.

Examples
(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


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