Skip to Main Content Skip to Search
Product Documentation

actxserver - Create COM server

Syntax

h = actxserver('progid')
h = actxserver('progid','machine','machineName')
h = actxserver('progid','interface','interfaceName')
h = actxserver('progid','machine','machineName','interface','interfaceName')
h = actxserver('progid',machine)

Description

h = actxserver('progid') creates a local OLE Automation server, where progid is the programmatic identifier of the COM server, and h is the handle of the server's default interface.

Get progid from the control or server vendor's documentation. To see the progid values for MATLAB software, refer to Programmatic Identifiers.

h = actxserver('progid','machine','machineName') creates an OLE Automation server on a remote machine, where machineName is a string specifying the name of the machine on which to start the server.

h = actxserver('progid','interface','interfaceName') creates a Custom interface server, where interfaceName is a string specifying the interface name of the COM object. Values for interfaceName are

You must know the name of the interface and have the server vendor's documentation in order to use the interfaceName value. For information about custom COM servers and interfaces, see COM Server Types.

h = actxserver('progid','machine','machineName','interface','interfaceName') creates a Custom interface server on a remote machine.

The following syntaxes are deprecated and will not become obsolete. They are included for reference, but the syntaxes described earlier are preferred:

h = actxserver('progid',machine) creates a COM server running on the remote system named by the machine argument. This can be an IP address or a DNS name. Use this syntax only in environments that support Distributed Component Object Model (DCOM).

Tips

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 on 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.

You can register events for COM servers.

COM functions are available on Microsoft Windows systems only.

Examples

Microsoft Excel Workbook Example

This example creates an OLE Automation server, Excel® version 9.0, and manipulates a workbook in the application.

Create a COM server running Microsoft Excel.

e = actxserver ('Excel.Application')
e =     
    COM.Excel.application

Make the Excel frame window visible

e.Visible = 1;

Use the get method on the Excel object "e" to list all properties of the application:

e.get

 Properties

Create an interface "eWorkBooks":

eWorkbooks = e.Workbooks
eWorkbooks =
   Interface.Microsoft_Excel_9.0_Object_Library.Workbooks

List all methods for that interface

eWorkbooks.invoke

 Methods

Add a new workbook "w", also creating a new interface:

w = eWorkbooks.Add
w =
   Interface.Microsoft_Excel_9.0_Object_Library._Workbook

Close Excel and delete the object

e.Quit;
e.delete;

See Also

actxcontrol | actxGetRunningServer | delete (COM) | interfaces | invoke | load (COM) | release | save (COM)

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS