Call COM Objects
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
微软办公室
此示例显示了如何将MATLAB矩阵写入Excel®电子表格。
Read Spreadsheet Data Using Excel as Automation Server
此示例显示了如何使用COM Automation Server访问MATLAB的另一个应用程序。
此示例显示了如何在Excel®电子表格中更改光标图标。
Change Row Height in Range of Spreadsheet Cells
此示例显示了如何更改行的高度,由Range
object, 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.
此示例显示了如何从打开文件中读取数据,Weekly_log.xlsx
, in MATLAB.
Display Message for Workbook OnClose Event
此示例显示了如何处理com接口事件,如何在微软Excelworkbook
object, and how to handle itsBeforeclose
event.
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
控制。
此示例显示了如何使用本地函数将事件处理程序合并到单个文件中。
此示例显示了如何还原原始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.
概念
COM concepts and an overview of COM support in MATLAB software
示例显示了如何使用MATLAB软件使用COM接口
Registering Controls and Servers
在使用COM对象之前,您必须注册其控件和服务器。
如何创建Microsoft ActiveX控制和com服务器对象
Pass data to and handle data from a COM object
列出属性名称并设置值,使用多个对象和属性,使用属性检查器,使用枚举的值和自定义属性
You execute, or调用,com函数或属于com对象的方法。
响应事件,写事件处理程序
对于控件,请在创建控件实例时注册处理程序功能(使用actxcontrol
), or any time afterward (usingregisterevent
)。
Use these MATLAB functions to save and restore the state of a COM control object.
Use COM interfaces
COM收藏是支持可以迭代的相关com万博1manbetx对象组的一种方法。
Supported Client/Server Configurations
COM client-server configurations in MATLAB software
微软Forms2.0 controls are designed for use with applications enabled byMicrosoft Visual Basic®用于应用程序(VBA)。
分布式组件对象模型(DCOM)是一个协议,允许客户端通过网络使用远程com对象。
故障排除
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.