External Interfaces Previous page   Next Page

Introducing MATLAB COM Integration

The Component Object Model, or COM, provides a framework for integrating reusable, binary software components into an application. Because components are implemented with compiled code, the source code may be written in any of the many programming languages that support COM. Upgrades to applications are simplified, as components can be simply swapped without the need to recompile the entire application. In addition, a component's location is transparent to the application, so components may be relocated to a separate process or even a remote system without having to modify the application.

Using COM, developers and end users can select application-specific components produced by different vendors and integrate them into a complete application solution. For example, a single application may require database access, mathematical analysis, and presentation-quality business graphs. Using COM, a developer may choose a database-access component by one vendor, a business graph component by another, and integrate these into a mathematical analysis package produced by yet a third.

This section of the documentation covers

Concepts and Terminology

Here are some terms that you should be familiar with before reading this chapter.

COM Objects

A COM object is an instance of a component object class, or component. COM enforces complete encapsulation of the object, preventing its data and implementation from being accessed directly. The methods of an object must be accessed through an interface. A COM object runs in a server application that is controlled by one or more client applications.

Programmatic Identifier

When creating an instance of a COM component from within MATLAB, you refer to the component using its programmatic identifier, or ProgID. The ProgID is a string defined by the component vendor to uniquely define a particular COM component. You should be able to obtain this identifier from the vendor's documentation. The ProgID for MATLAB is matlab.application.

Interfaces

An interface provides access to the properties and methods of a COM object. In fact, the only way to access the internals of a COM object is through its interface. An interface does not contain any method implementation; it just serves as a pointer to the methods within the object.

Interfaces usually group a set of logically related methods together. An object may, and frequently does, expose (or make available) more than one interface. In order to use any COM object, you must learn about which interfaces it supports, and the methods, properties, and events implemented by the object. The component vendor provides this information.

IUnknown, IDispatch, Custom, and Dual Interfaces

The basic types of interfaces into COM objects are

ActiveX Control

An ActiveX control is a component that has a user interface, enabling it to respond to actions taken by the user. A window that has OK and Cancel buttons can be implemented as a control, for example. A control runs in the process address space of its client application. The client is said to be a control container since it contains the control.

The client application is able to directly access the methods and properties of a control. The control must also be able to communicate back to the client. This enables it to notify the client application of an event occurrence, such as a mouse click.

In-Process and Out-of-Process Servers

You can configure a server in one of three ways. MATLAB supports all of these configurations:


Previous page  COM and DDE Support (Windows Only) Supported Client/Server Configurations Next page

© 1994-2005 The MathWorks, Inc.