The Tutorial Example: AutoClik

In this tutorial you will create AutoClik, a simple Automation server application. When running as a stand-alone application, AutoClik displays  text at the last point at which the user clicked the mouse. The user can change the text displayed by specifying it in a dialog box. When running as an Automation server, AutoClik allows Automation clients to simulate both the mouse clicking and the changing of text (without opening the dialog box).

An Automation server is not necessarily an ActiveX object server; AutoClik isn’t. AutoClik could have been implemented as both an Automation server and an ActiveX object server, but this tutorial focuses entirely on adding Automation server functionality to an application.

How Automation Clients Access Automation Objects

For an Automation client to drive an Automation server, the client must gain knowledge of one or more “dispatch interfaces” of the server. A dispatch interface is the external programming interface of some grouping of functionality exposed by the Automation server. AutoClik provides two dispatch interfaces. The first exposes AutoClik’s mouse clicking and text data entry functions. The second, introduced for tutorial rather than practical reasons, represents a simple structure: a point given by x and y coordinates.

A dispatch interface consists of two types of programming interfaces: properties and methods. AutoClik exposes both. An Automation client can get or set the x and y properties representing the location of the text in AutoClik’s window. Or  an Automation client can set the x and y coordinates and the text all at once by using a method with three parameters — x, y, and text.

To exercise AutoClik’s Automation functionality, you will use the Autodriv sample application provided with Visual C++. Autodriv is a simple Automation client application. The following preview of AutoClik illustrates how you can drive an Automation server using Autodriv.