## OCX/ActiveX Controls and OLE Automation

Note: This section applies to Windows only

APLX for Windows supports OLE Automation (also known as just Automation, or COM), a powerful facility which allows your APLX functions to use external software and controls to enhance the functionality of your applications. There are three ways in which you can use this feature:

(a) You can place external OCX or ActiveX controls directly on your APLX windows. For example, you can use the Formula One Excel-style spreadsheet control as though it were a built-in APLX control. This is done simply by creating a window and then creating an external control on it.

(b) You can embed OLE (Object Linking and Embedding) documents in your windows. For example, you could include a Microsoft Word document as part of a more complex window, merging the Word menus and toolbar with your own. To allow this, APLX includes a control called an 'OLEContainer' which you place on your window. You can then specify the document to be embedded or linked, or allow the user to select one.

(c) You can invoke and exchange data and commands with external OLE Server Applications. This is somewhat similar to (b), but the application runs independently of APLX and is not embedded in one of your windows. For example, you could invoke Excel, cause it to load a spreadsheet, and extract the data from the spreadsheet as an APL nested array, without the user being involved.

In each case, you create an object using ŚNEW or ŚWI. This object will have properties, methods, and events which belong to the external software but which you can access just as you do with ordinary APLX objects. (To avoid any possible ambiguity, each external property, method, or event name is prefixed with an 'x', but you can omit this if you prefer.)

### Properties supporting Automation

The System object has three properties which each return an N by 4 nested array of the external controls and servers installed on your system. These properties are:

`xclasses` OCX/ActiveX controls - case (a) above
`oledoctypes` Document types which can be embedded in an OLEContainer - case (b) above
`oleclasses` Server applications which you can invoke - case (c) above

The returned array has one row for each external control or server installed (not all of these will necessarily be accessible).

The first column is the plain text name, for example 'Chart FX'. The second column is an alphanumeric string enclosed in curly brackets, which is the unique ID of the automation object. The third column is the object class name, which is usually a period-delimited string giving the vendor name, object class name and optionally the version number, for example 'SoftwareFX.ChartFX.20'. (The fourth column is reserved for future use).

You can use any of these as the class name to identify the control to APLX, but we recommend that you use the third.

You can also use the Control Browser (on the Tools menu) to see the same information together with more detail on the properties, methods, events and constants exported by the control.

Topic: APLX Help : System Classes : OCX/ActiveX Controls and OLE Automation

[ Next | Contents | Index ]