| External Interfaces Reference | ![]() |
List custom interfaces to COM server
Syntax
Description
C = h.interfaces
returns cell array of strings C listing all custom interfaces implemented by the component in a specific COM server. The server is designated by input argument, h, which is the handle returned by the actxcontrol or actxserver function when creating that server.
C = interfaces(h)
is an alternate syntax for the same operation.
Note
interfaces only lists the custom interfaces; it does not return any interfaces. Use the invoke function to return a handle to a specific custom interface.
|
Examples
Once you have created a COM server, you can query the server component to see if any custom interfaces are implemented. Use the interfaces function to return a list of all available custom interfaces:
h = actxserver('mytestenv.calculator') h = COM.mytestenv.calculator customlist = h.interfaces customlist = ICalc1 ICalc2 ICalc3
To get a handle to the custom interface you want, use the invoke function, specifying the handle returned by actxcontrol or actxserver and also the name of the custom interface:
You can now use this handle with most of the COM client functions to access the properties and methods of the object through the selected custom interface. For example, to list the properties available through the ICalc1 interface, use
c1.invoke Add = double Add(handle, double, double) Divide = double Divide(handle, double, double) Multiply = double Multiply(handle, double, double) Subtract = double Subtract(handle, double, double)
Add and multiply numbers using the Add and Multiply methods of the custom object c1:
See Also
actxcontrol, actxserver, invoke, get
| get (COM) | invoke | ![]() |
© 1994-2005 The MathWorks, Inc.