Using Automated Annotations in Run Mode:

Take the following steps to add code, to the existing project, that will let you display annotations in run mode and activate a button annotation.

1. Start with the program you created in Implementing an Automated Annotation Program.
2. Add a User Mode menu item.
  a. From the View menu, select Solution Explorer.
  b. in the Solution Explorer window, right click the LoadSave.rc item and choose View Code
  c. Add the following code to the MENU_MAIN MENU section of LoadSave.rc (items to add shown in green )

 

MENU_MAIN MENU   
BEGIN   
    MENUITEM "&Open...", IDM_OPEN   
    MENUITEM "&Save...", IDM_SAVE   
    POPUP "User Mode"   
    BEGIN   
        MENUITEM "Design", IDM_DESIGN, CHECKED   
        MENUITEM "Run", IDM_RUN   
    END   
    MENUITEM "E&xit", IDM_EXIT   
END 

3.

In the Loadsave.h file, add the following defines after the define for IDM_EXIT

   #define IDM_RUN 400   
   #define IDM_DESIGN 500 

4.

In the Window_OnCommand procedure, add the following code to the switch statement:

   case IDM_RUN:   
      L_AnnSetUserMode(hContainer, ANNUSER_RUN);   
      CheckMenuItem(GetMenu(hWnd), IDM_DESIGN, MF_UNCHECKED);   
      CheckMenuItem(GetMenu(hWnd), IDM_RUN, MF_CHECKED);   
      break;   
   case IDM_DESIGN:   
      L_AnnSetUserMode(hContainer, ANNUSER_DESIGN);   
      CheckMenuItem(GetMenu(hWnd), IDM_RUN, MF_UNCHECKED);   
      CheckMenuItem(GetMenu(hWnd), IDM_DESIGN, MF_CHECKED);   
   break; 

5.

Add the following case to the Window_AnnEvent procedure

case LTANNEVENT_AUTOCLICKED: 
{ 
   L_UINT uType = 0; 
   L_AnnGetType((HANNOBJECT)lParam, &uType); 
   if (uType == ANNOBJECT_BUTTON) 
      _wsystem(TEXT("Calc")); 
} 
break; 

6.

Build LoadSave.exe.

7.

Run LoadSave.exe. Create an audio annotation. Right click on the annotation and set the file to any .wav file available on your system. Create a button annotation. Right click on the annotation and change any of the button properties you wish. On the User Mode menu, select Run Mode. As you move the cursor over the audio annotation and the button annotation, the cursor changes to a hand. Click on the audio annotation to hear the .wav file. Click on the button annotation to call the program listed under WM_LTANNEVENT.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help