with-coclass disp form* => values
disp ::= (dispatch-function coclass-name &key interface-name punk clsctx)
The names of the dispatch function, coclass and so on.
A symbol which will be defined as a macro, as if by with-dispatch-interface
. The macro can be used by the forms to invoke the Automation methods of the component.
A symbol which names the coclass. It is not evaluated.
A symbol naming an interface in the coclass. It is not evaluated.
A symbol which will be bound to the interface pointer.
A CLSCTX value, which defaults to CLSCTX_SERVER
.
A form to be evaluated.
Calls create-object
to make an instance of the coclass named by the symbol coclass-name. If interface-name is given then that interface is queried from the component, otherwise the default interface is queried. Each form is evaluated in turn with dispatch-function bound of a local macro for invoking methods on the interface, as if by with-dispatch-interface
. After the forms have been evaluated, the interface pointer is released. If punk is given, it will be bound to the interface pointer while the forms are being evaluated.
If a type library containing the coclass TestComponent
has been converted to Lisp, then following can be used to make an instance of component and invoke the Greet()
method on the default interface.
(with-coclass (call-it test-component)
(call-it greet "hello"))
LispWorks COM/Automation User Guide and Reference Manual - 23 Mar 2017