文档

Call COM Objects

Access COM components and ActiveX®来自MATLAB的控件®

The Microsoft®组件对象模型((COM) provides a framework for integrating reusable, binary software components into an application. Because components are implemented with compiled code, the source code can be written in programming languages that support COM. Upgrades to applications are simplified, as components can simply be swapped without the need to recompile the entire application. In addition, a component's location is transparent to the application, so components can be relocated to a separate process or even a remote system without having to modify the application.

另外,请考虑使用Microsoft .NET框架。

MATLAB支万博1manbetx持COM和Microsoft Windows上的.NET框架集成®仅平台。

职能

actxserver 创建COM服务器
actxcontrol 在图窗口中创建Microsoft ActiveX控件
ActXControllist 列表当前已安装的Microsoft ActiveX控件
actxcontrolselect 从UI创建Microsoft ActiveX控件
EventListeners 与COM对象事件关联的列表事件处理程序功能
MethodsView View class methods
registerevent 运行时间com对象事件的副事件处理程序
unregisterallevents 取消与COM对象事件关联的所有事件处理程序
unregisterevent 在运行时与COM对象事件关联的Unregister事件处理程序
iscom 确定输入是com还是ActiveX对象
isevent 确定输入是否为com对象事件
isinterface Determine whether input is COM interface

对象

COM 访问MATLAB的COM组件和ActiveX控件

例子and How To

微软办公室

使用ActiveX将数据写入Excel电子表格

此示例显示了如何将MATLAB矩阵写入Excel®电子表格。

Read Spreadsheet Data Using Excel as Automation Server

此示例显示了如何使用COM Automation Server访问MATLAB的另一个应用程序。

更改电子表格中的光标

此示例显示了如何在Excel®电子表格中更改光标图标。

Change Row Height in Range of Spreadsheet Cells

此示例显示了如何更改行的高度,由Rangeobject, in a spreadsheet.

Insert Spreadsheet After First Sheet

这个例子shows how to skip an optional input argument in the Excel添加method, used to insert a sheet into a workbook.

连接到现有的Excel应用程序

此示例显示了如何从打开文件中读取数据,Weekly_log.xlsx, in MATLAB.

Display Message for Workbook OnClose Event

此示例显示了如何处理com接口事件,如何在微软Excelworkbookobject, and how to handle itsBeforecloseevent.

探索com对象

Learn about a COM object using MATLAB commands

ActiveX控件

MATLABSample ActiveX Control mwsamp

MATLABincludes an example COM control that draws a circle on the screen, displays some text, and fires events when the user single- or double-clicks the control.

Redraw Circle in mwsamp Control

这个例子shows how to call a method of themwsamp控制以重绘一个圆圈。

Display Event Messages from mwsamp Control

这个例子shows how to handle events fired by the MATLAB ActiveX control,mwsamp2

添加位置Property to mwsamp Control

此示例显示了如何添加自定义属性,位置mwsamp控制。

将事件处理程序组合为MATLAB本地功能

此示例显示了如何使用本地函数将事件处理程序合并到单个文件中。

Save mwsamp2 COM Control

此示例显示了如何还原原始mwsamp2控制设置。

Deploy ActiveX Controls Requiring Run-Time Licenses

When you deploy aMicrosoft ActiveX需要运行时许可证的控制,包括一个许可证密钥,该控件在运行时读取。

IE浏览器

Use Internet Explorer in MATLAB Figure

此示例使用ActiveX控件Shell.Explorer,由Microsoft Internet Explorer暴露®application, to include an HTML viewer in a MATLAB figure.

概念

MATLAB COM集成

COM concepts and an overview of COM support in MATLAB software

com入门

示例显示了如何使用MATLAB软件使用COM接口

Registering Controls and Servers

在使用COM对象之前,您必须注册其控件和服务器。

创建com对象

如何创建Microsoft ActiveX控制和com服务器对象

在MATLAB中处理com数据

Pass data to and handle data from a COM object

COM Object Properties

列出属性名称并设置值,使用多个对象和属性,使用属性检查器,使用枚举的值和自定义属性

com方法

You execute, or调用,com函数或属于com对象的方法。

com活动

响应事件,写事件处理程序

com活动处理程序

对于控件,请在创建控件实例时注册处理程序功能(使用actxcontrol), or any time afterward (usingregisterevent)。

保存并删除co​​m对象

Use these MATLAB functions to save and restore the state of a COM control object.

com对象接口

Use COM interfaces

com集合

COM收藏是支持可以迭代的相关com万博1manbetx对象组的一种方法。

Supported Client/Server Configurations

COM client-server configurations in MATLAB software

微软表格2.0控件

微软Forms2.0 controls are designed for use with applications enabled byMicrosoft Visual Basic®用于应用程序(VBA)。

MATLAB应用作为DCOM客户端

分布式组件对象模型(DCOM)是一个协议,允许客户端通过网络使用远程com对象。

故障排除

MATLABCOM Support Limitations

Microsoft不支持加载32位DL万博1manbetxL或在64位应用程序中或相反的应用程序中加载COM服务器。

Interpreting Argument Callouts in COM Error Messages

When a MATLAB client sends a command with an invalid argument to a COM server application, the server sends back an error message in the following format.

Was this topic helpful?