External Interfaces/API Reference |
Invoke a method on an object or interface
Syntax
Arguments
h
Handle for a COM object previously returned from actxcontrol
, actxserver
, get
, or invoke
.
method
name
A string that is the name of the method to be invoked.
arg1, ..., argn
Arguments, if any, required by the method being invoked.
Description
Invoke a method on an object's interface and retrieve the return value of the method, if any. The data type of the value is dependent upon the specific method being invoked and is determined by the specific control or server. If the method returns a COM interface, then invoke
returns a new MATLAB COM object that represents the interface returned. See Converting Data in the External Interfaces documentation for a description of how MATLAB converts COM data types.
When you specify only a handle argument with invoke, MATLAB returns a structure array containing a list of all methods available for the object and their prototypes.
Examples
Create an mwsamp
control and invoke its Redraw
method:
f = figure ('pos', [100 200 200 200]); h = actxcontrol ('mwsamp.mwsampctrl.1', [0 0 200 200], f); set(h, 'Radius', 100); invoke(h, 'Redraw');
Here is a simpler way to invoke
. Just call the method directly, passing the handle, and any arguments:
Call invoke
with only the handle argument to display a list of all mwsamp
methods:
invoke(h) ans = Beep: 'void Beep(handle)' Redraw: 'void Redraw(handle)' GetVariantArray: 'Variant GetVariantArray(handle)' . . etc.
See Also
inspect | isevent (COM) |