Use theactxserver
强啡肽的功能来创建一个进程内服务器mic link library (DLL) component or an out-of-process server for an executable (EXE) component.
To create a server for a component implemented as a dynamic link library (DLL), use theactxserver
function. MATLAB®creates an instance of the component in the same process that contains the client application.
The syntax foractxserver
, when used with a DLL component, isactxserver(ProgID)
, whereProgID
is the programmatic identifier for the component.
actxserver
returns a handle to the primary interface to the object. Use this handle to reference the object in other COM function calls. You can also use the handle to obtain more interfaces to the object. For more information on using interfaces, seeCOM Object Interfaces.
Unlike通过显微镜osoft®ActiveX®controls, any user interface displayed by the server appears in a separate window.
You cannot use a 32-bit in-process DLL COM object in a 64-bit MATLAB application. For information about this restriction, seeWhy am I not able to use 32-bit DLL COM Objects in 64-bit MATLAB?.
You can use theactxserver
function to create a server for a component implemented as an executable (EXE). In this case, MATLAB instantiates the component in an out-of-process server.
The syntax foractxserver
to create an executable isactxserver (ProgID sysname)
.ProgID
is the programmatic identifier for the component, andsysname
is an optional argument used in configuring a distributed COM (DCOM) system.
actxserver
returns a handle to the primary interface to the COM object. Use this handle to reference the object in other COM function calls. You can also use the handle to obtain more interfaces to the object. For more information on using interfaces, seeCOM Object Interfaces.
Any user interface displayed by the server appears in a separate window.
This example creates a COM server application running the通过显微镜osoft Excel®spreadsheet program. The handle is assigned toh
.
h = actxserver('Excel.Application')
MATLAB displays:
h = COM.excel.application
MATLAB can programmatically connect to an instance of a COM Automation server application that is already running on your computer. To get a reference to such an application, use theactxGetRunningServer
function.
This example gets a reference to the Excel program, which must already be running on your system. The returned handle is assigned toh
.
h = actxGetRunningServer('Excel.Application')
MATLAB displays:
h = COM.excel.application