External Interfaces Reference |
Syntax
Description
h = actxserver(progid)
creates a COM server, and returns COM object, h
, representing the server's default interface. progid
is the programmatic identifier of the component to instantiate in the server. This string is provided by the control or server vendor and should be obtained from the vendor's documentation. For example, the progid
for MATLAB is matlab.application
.
h = actxserver(progid,
creates a COM server running on the remote system named by the systemname
)
systemname
argument. This can be an IP address or a DNS name. Use this syntax only in environments that support Distributed Component Object Model (DCOM).
Remarks
For components implemented in a dynamic link library (DLL), actxserver
creates an in-process server. For components implemented as an executable (EXE), actxserver
creates an out-of-process server. Out-of-process servers can be created either on the client system or any other system on a network that supports DCOM.
If the control implements any custom interfaces, use the interfaces
function to list them, and the invoke
function to get a handle to a selected interface.
There is currently no support for events generated from automation servers.
Examples
Create a COM server running Microsoft Excel and make the main frame window visible:
Call the get
method on the excel
object to list all properties of the application:
e.get ans = Application: [1x1Interface.Microsoft_Excel_9.0_Object_ Library._Application] Creator: 'xlCreatorCode' Workbooks: [1x1 Interface.Microsoft_Excel_9.0_Object_ Library.Workbooks] Caption: 'Microsoft Excel - Book1' CellDragAndDrop: 0 ClipboardFormats: {3x1 cell} Cursor: 'xlNorthwestArrow' . .
List all methods for that interface by calling invoke
with just the handle argument:
eWorkbooks.invoke ans = Add: 'handle Add(handle, [Optional]Variant)' Close: 'void Close(handle)' Item: 'handle Item(handle, Variant)' Open: 'handle Open(handle, string, [Optional]Variant)' OpenText: 'void OpenText(handle, string, [Optional]Variant)'
Invoke the Add
method on workbooks
to add a new workbook, also creating a new interface:
Quit the application and delete the object:
See Also
actxcontrol
, release
, delete
, save
, load
, interfaces
actxcontrolselect | addproperty |
© 1994-2005 The MathWorks, Inc.