LEADTOOLS accesses automation through the AUTOMATIONHANDLE structure. This structure provides a working area for the LEADTOOLS automation functions. This automation handle must be initialized before calling any of the automation functions. This is done using the L_AutInit function. The following example shows how to initialize the Automation handle:
/*Automation handle variable*/
pAUTOMATIONHANDLE pAutomation;
/* initiate the Automation */
L_AutInit(pAutomation);
After initializing an Automation handle, the user must create the automation handle, based on the type of automation handle needed. To create a vector automation handle, call L_AutCreate with the nMode parameter set to AUTOMATION_MODE_VECTOR.
When the AUTOMATIONHANDLE structure is no longer needed, it should be freed using the L_AutFree function. The following is an example that shows how to free an automation handle:
if (SUCCESS == L_AutIsValid(pAutomation)) /* check the validity of the Automation handle */
{
/* free the Automation handle */
L_AutFree(pAutomation);
return SUCCESS;
}
An automation handle is valid only after L_AutInit and L_AutCreate have been called. The validity of an automation handle should be checked before calling any other automation functions. This is done using L_AutIsValid.