Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

Painting Pages and Zones Using OCR Professional

Show in webframe

To add code to an existing project in order to paint pages and zones:

1.

Start with the program you created in Working with Zones.

2.

Define the following global variables in EZFUNC.H in the OCR_Ltdoc2 directory:

L_BOOL bDrawZones;
L_BOOL bDrawPage; 

3.

Define the following global IDs in Ezfunc.h in the OCR_Ltdoc2 directory:

#define IDM_DRAW_ZONES              204
 

4.

Edit EZFUNC.RC file in the OCR_Ltdoc2 directory and add the following lines:

 

MAIN_MENU   MENU
BEGIN
   ... 
   ... 
   MENUITEM "Enable Draw Zones"     IDM_DRAW_ZONES
END

 

5.

In Ezfunc.cpp in the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:

      case IDM_DRAW_ZONES: 
         bDrawZones = !bDrawZones; 
         InvalidateRect (hWnd, NULL, FALSE);
         break;

 

6.

In EZFUNC.CPP under WM_CREATE inside IDM_INSERT_PAGE, add the following after "L_Doc2AddPage()if (nRet != SUCCESS){}" :

      L_Doc2SetActivePage(hDoc, 0);
      bDrawPage = TRUE;

      /* Get the client area of the adjusted window */
      GetClientRect(hWnd,&rClientSize);
      /* Make the destination rectangle for painting the same as the client area */
      rLeadDest = rClientSize; 

7.

In the MainWndProc procedure, replace the following code to WM_PAINT (Refer to documentation for an explanation of L_Doc2DrawPage function):

   case WM_PAINT:
      hdc = BeginPaint (hWnd, &ps); 

      if (bDrawPage)
      {
         if (hpalPaint) /* If we have a paint palette, select it */
         {
            hPalette = SelectPalette (hdc, hpalPaint, TRUE);
            /* Uncomment this if you do not process WM_QUERYNEWPALETTE */
            /* RealizePalette (hdc); */
         }

         L_Doc2DrawPage(hDoc, hdc, 0, NULL, NULL, &rLeadDest, &ps.rcPaint, SRCCOPY, bDrawZones);
         if (hpalPaint)         /* Return old palette */
            SelectPalette (hdc, hPalette, TRUE);
      }

      EndPaint (hWnd, &ps); /* Return DC */
      return 0; 

8.

Build SimpleLoad.exe.

9.

Run SimpleLoad.exe.

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.