Preview of the AutoClik Application

Before you work through the steps of implementing AutoClik, try out the completed application. This will help you appreciate Automation functionality in general, and AutoClik’s Automation server functionality in particular, from a user’s point of view.

The first step is to register AutoClik. Just as with ActiveX object servers, an Automation server must be registered before it can be driven by any Automation client.

To install and register the AutoClik Automation server

  1. Run AutoClik.exe from the sample source files for Step 3 (see Installing the Sample Files and Previewing the Sample Applications in Scribble Lesson 1 for detailed steps).

    Running AutoClik briefly as a stand-alone application registers it in the system registry as an ActiveX component.

  2. Close AutoClik.

To preview AutoClik

  1. Run Autodriv from the sample source files.

    This starts Autodriv, which launches and displays the AutoClik Test Driver dialog box shown below.

    AutoClik Test Driver Dialog Box

  2. Arrange the open windows on your desktop, minimizing any as necessary, so that AutoClik is visible next to Autodriv’s window, without obscuring it.

    Autodriv launches AutoClik on startup.

    AutoClik Window Next to Autodriv Window

To explore the Automation server features of AutoClik

  1. Note that the x, y, and Text fields in the AutoClik Test Driver dialog box are initially blank. To change this, click the Get All button.

    The current AutoClik coordinates and text are now displayed in Autodriv’s window.

  2. Click around in the AutoClik window.

    Notice that the x, y, and Text fields in Autodriv do not change. That is because the Automation is one direction between Autodriv and AutoClik. Although you can implement an Automation server to notify the Automation client about changes, such as the new coordinates in AutoClik, this feature requires that additional callback/notification interfaces be established so that the Automation client can implement them.

  3. From AutoClik’s Edit menu, click Change Text.

  4. In the Change Text dialog box, change the text to “hello”, and click OK.

  5. In the Autodriv window, click the Get All button.

    It now shows new x, y, and Text values.

  6. Change the x, y, and Text values in Autodriv, and click the Set All button.

    AutoClik displays the changes.

  7. Explore other Autodriv commands:
    Command Description
    Set x, Set y Accesses just the x or y coordinate of the text. The x and y properties of AutoClik’s document dispatch interface are exposed by using Get and Set methods. AutoClik’s implementation of SetX and SetY includes updating the window to reflect the change.
    Get Position, Set Position Changes the x and y coordinates of the text by using  AutoClik’s second dispatch interface, which represents a Point.
    Set Text Changes the Text property of AutoClik, which is directly exposed as a string rather than by using a pair of Get and Set functions. This means that when you choose the Set Text command, AutoClik has no opportunity to detect the change as it did when you chose the Set x, Set y, or Set Position commands. Therefore, AutoClik does not immediately update its window. To do so, you must then click the Refresh Display button.
    Set All Simultaneously changes AutoClik’s x, y, and Text properties through its SetAllProps method, which uses these three parameters. AutoClik’s implementation of SetAllProps includes immediate updating of the window.
    Get All Queries the x, y, and Text properties of AutoClik and returns their current values.
    Refresh Display Updates AutoClik’s window based on the most recent values of x, y, and Text, which might have been previously set using Automation.
    Animate x & y Updates AutoClik’s x and y coordinates in 20 steps, by individually updating the x property and then the y property.
    Animate Position Updates AutoClik’s x and y coordinates through its Point interface. Because the Point interface updates both the x and y values at the same time, the animation results in a smooth diagonal movement of the text across AutoClik’s window.