Next Previous Up Top Contents Index

4 OLE Automation

4.4 Example of Automation

Functional Developer includes two example applications to demonstrate Automation and how to implement it in Dylan. The first application implements an Automation controller that sends commands to the second application, an Automation server.

You can find the controller application in the following folder under your Functional Developer installation:

Examples\ole\sample-automation-controller

The Automation server is in:

Examples\ole\sample-automation-server

The server is a simple drawing window that paints shapes upon command from the controller. A user can press buttons on the controller to make the server draw a circle or square, change the paint color, or clear its drawing window.

To use these applications, first open them from the Functional Developer IDE's Examples dialog, where you can find them under the "OLE" section.

Next build the applications with Project > Build.

Before you can run them, you need to register the Automation server with Windows so that the controller can connect to it. To register the server, at MS-DOS prompt go to

Examples\ole\sample-automation-server\build

and call

ms-dos> sample-automation-server.exe /RegServer

(See "Registering OLE/COM software" on page 125 for more details of registration.)

You should now be able to test the example.

1. Start the sample-automation-server.exe application.
The server appears.

Figure 4.1 Sample Automation server at start-up.

2. Start the sample-automation-controller.exe application.
You can find it in the build subfolder of the folder containing its sources.
The controller appears.

Figure 4.2 Sample Automation controller.

3. Click the Draw Circle button in the controller window.
A circle appears in the server window.

Figure 4.3 Automation server after clicking Draw Circle in controller.

The command to draw a circle was sent via the COM connection from the controller to the server, which recognized and responded to it.

4. Try issuing some other commands.

OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index