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

com-object-dispinterface-invoke Generic Function

Summary

A generic function called by IDispatch::Invoke when there is no defined dispinterface method.

Package

com

Signature

com-object-dispinterface-invoke com-object method-name method-type args => value

Arguments
com-object
A COM object whose method is being invoked.
method-name
A string naming the method to be called.
method-type
A keyword specifying the type of method being called.
args
A vector containing the arguments to the method.
Values
value
A value suitable for return from a COM method.
Description

The generic function com-object-dispinterface-invoke is called by IDispatch::Invoke when there is no method defined using define-dispinterface-method.

Methods can be written for com-object-dispinterface-invoke, specializing on an Automation implementation class and implementing the method dispatch based on method-name and method-type.

method-name is a string specifying the name of the method as given by the method declaration in the IDL or type library.

method-type, has one of the following values:

:get
when invoking a property getter method.
:put
when invoking a property setter method.
:method
when invoking a normal method.

The arguments to the method are contained in the vector args, in the order specified by the method declaration in the type library. For in and in-out arguments, the corresponding element of args contains the argument value converted to the type specified by the method declaration and then converted to Lisp objects as specified in 3.3.3 Data conversion when calling Automation methods. For out and in-out arguments, the corresponding element of args should be set by the method to contain the value to be returned to the caller and will be converted to an automation value as specified in 3.3.3 Data conversion when calling Automation methods.

value should be a value which can be converted to the appropriate return type as the primary value of the method and will be converted to an automation value as specified in 3.3.3 Data conversion when calling Automation methods. It is ignored for methods that are declared as returning void.

Notes

When using com-object-dispinterface-invoke, it is not possible to distinguish between invocations of the same method name for different interfaces when com-object implements several interfaces. If this is required, then the method must be defined with define-dispinterface-method.

Examples
(defmethod com:com-object-dispinterface-invoke ((this my-dispinterface)
                                                method-name
                                                method-type
                                                args)
  (cond ((equal method-name "MyProperty")
         (case method-type
           (:get
            (slot-value this 'my-property))
           (:put
            (setf (slot-value this 'my-property)
                  (svref args 0)))))
        ((equal method-name "MyMethod")
         (format t "MyMethod was called~%"))
        (t (call-next-method))))
See also

define-dispinterface-method


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