Main Content

actxserver

Create COM server

Description

example

c = actxserver(progid) creates a local OLE Automation server, where progid is the programmatic identifier (ProgID) of an OLE-compliant COM server. The function returns a handle to the default interface of the server.

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. You can create out-of-process servers either on the client system or on any other system on a network that supports DCOM.

c = actxserver(progid,'machine',machineName) creates a server on a remote computer.

Examples

collapse all

Create a Microsoft® Excel® object and display the ActivePrinter property. MATLAB® displays the value for your system.

e = actxserver('Excel.Application');
get(e,'ActivePrinter')
ans = \\printers\Copy-Fl2-South on Ne04:

When you are finished with the application, close Excel in MATLAB and delete the server object.

Quit(e)
delete(e)

Input Arguments

collapse all

Programmatic identifier, specified as a string or a character vector. The server vendor documentation specifies the ProgID. For MATLAB progid values, see Programmatic Identifiers.

Example: 'Matlab.Application'

Name of remote computer on which to start the server, specified as a string or a character vector.

Example: 'machine','mymachine'

Limitations

  • COM functions are available on Microsoft Windows® systems only.

  • 64-bit MATLAB does not support custom interfaces.

  • The MATLAB COM Interface does not support invoking functions with optional parameters.

Tips

  • You can register events for COM servers. For more information, see COM Events.

Introduced before R2006a