actxserver

Create COM server

Description

example

c= actxserver(progid)creates a local OLE Automation server, whereprogidis theprogrammatic 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),actxservercreates an in-process server. For components implemented as an executable (EXE),actxservercreates 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

创建一个Microsoft®Excel®object and display theActivePrinterproperty. 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 MATLABprogidvalues, seeProgrammatic 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, seeCOM Events.

Introduced before R2006a