LAutomation::Create

#include "ltwrappr.h"

L_INT LAutomation::Create(nMode, dwFlags=0);

AUTOMATIONMODE nMode;

/* automation mode */

L_UINT32 dwFlags;

/* reserved */

Creates an automation handle.

Parameter

Description

nMode

An integer value that represents the automation mode to use when creating the automation handle. Possible values are:

 

Value

Meaning

 

AUTOMATION_MODE_PAINT

Creates an automation handle for digital paint.

 

AUTOMATION_MODE_VECTOR

Creates an automation handle for Vectors.

dwFlags

Reserved for future use. Use 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

LAutomation::Initialize must be called before calling this function.

If vector viewing support is unlocked using L_SUPPORT_VECTOR_VIEW, this function will return ERROR_VECTOR_LOCKED, if nMode is set to AUTOMATION_MODE_VECTOR.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LAutomation::Initialize, LAutomation::Free

Topics:

Initializing, Creating and Freeing Automation Handles

Example

This example shows the minimum requirements for creating a Vector Automation.

L_INT LAutomation_CreateExample( HWND hWnd , LAutomation & lauto, pTOOLBARHANDLE g_pToolbar, LToolbar & tlb) 
{
   UNREFERENCED_PARAMETER(g_pToolbar);
   L_INT nRet;
   nRet = lauto.Initialize ();
   if (SUCCESS == nRet ) /* initiate the automation */
   {
      /* create the vector automation */
      nRet = lauto.Create (AUTOMATION_MODE_VECTOR, 0 );
      if ( SUCCESS != nRet ) 
      {
         ::MessageBox ( hWnd, TEXT("Error creating Vector Automation"), TEXT("Error:"), MB_ICONSTOP ) ;
         nRet = lauto.Free() ;
         if(nRet != SUCCESS)
            return nRet;
         return nRet;
      }
   }
   else
   {
      ::MessageBox ( hWnd, TEXT("Error Initializing Vector Automation"), TEXT("Error:"), MB_ICONSTOP ) ;
      return nRet; 
   }
   /* initiate the toolbar */
   nRet = tlb.Initialize ();
   if ( SUCCESS == nRet )
   {
      POINT pt = { 0, 0 } ;
      ::ClientToScreen ( hWnd, &pt ) ;
      /* create the vector toolbar */
      nRet = tlb.Create (hWnd, TEXT("Vector Automation"), TOOLBAR_VECTOR ) ;
      if(nRet != SUCCESS)
         return nRet;
      /* set the toolbar position */
     nRet = tlb.SetPosition (&pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;
     if(nRet != SUCCESS)
        return nRet;
      /* set the toolbar visible */
      nRet = tlb.SetVisible (TRUE ) ;
      if(nRet != SUCCESS)
         return nRet;
   }
   else
   {
      return nRet ;
   }
   /* set the automation toolbar */
   nRet = lauto.SetToolbar (&tlb ) ;
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS ;
}