Automation and the Container
The key element for notifying the user of automation events is the container. The primary purpose of the container is to automate drawing, as well as automate the collection and transformation of coordinates of objects within the container. Consequently, it is very important to understand the Container before using Automation.
Every window opened in an automation application should have a container associated with it. First, the container is initialized by calling L_ContainerInit. The container is then created and associated with a specified window using L_ContainerCreate. Once the container has been initialized, created and associated with a window, it can be added to the list of containers for a specific automation handle. The automation handle must be initialized and created by calling L_AutInit and L_AutCreate. Once the automation handle has been initialized and created, a container can be added to the automation list of containers using L_AutAddContainer. At this point, all automation functionality is associated with the container and the window that owns the container. All synchronization and data handling between the container and the automation handle will be done automatically.
The automation maintains a list of added containers. Therefore, the user must inform the automation of any changes made to a container that exists in the automation container list. Since an automation handle may have multiple containers associated with it, there must be a way to indicate which container is active. The active container is set by calling L_AutSetActiveContainer. While a container is active, all automation functions act on this container. To perform some automation function on another container, that container must be set as the active container. To determine which container is the active container, call L_AutGetActiveContainer.
With many containers associated with a single automation handle, it is occasionally necessary to enumerate the associated containers. L_AutEnumContainers enumerates all containers associated with the specified automation handle. For each container enumerated by L_AutEnumContainers, an AUTOMATIONENUMCONTAINERPROC callback function gets called. This allows for further processing of each enumerated container.
The user can issue any command to a container through the container handle. Therefore, it is important to remember that the same container handle is used internally by the automation.
When the window that owns a container is closed, the container should be removed from the list of automation containers using L_AutRemoveContainer. After the container is removed from the automation container list, the container handle should be freed using L_ContainerFree.
See Also