#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2SetProgressCB(hDoc, pfnCallback, pUserData)

Sets the progress callback function that should be used by the OCR engine to report progress and offer the client the opportunity to cancel.


L_HDOC2 hDoc

Handle to the OCR document.


Optional callback function for reporting progress of a specific operation.

If you do not provide a callback function, use NULL as the value of this parameter. Use NULL if no progress reporting is needed. If you do provide a callback function, use the function pointer as the value of this parameter.

The OCR engine calls this callback function as it reports the progress of a specific operation.

The callback function must adhere to the following function prototype: PROGRESSCALLBACK2.

L_VOID * pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer to the appropriate data type to access your variable or structure.

If the additional parameters are not needed, you can pass NULL in this parameter.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


To get the current process, check the Id member of the PROGRESSDATA2 structure, which is passed to the PROGRESSCALLBACK2 function.

Refer to the DOC2_OCRPROCID enumeration for the event types that can be reported to the progress callback.

Required DLLs and Libraries

See Also




L_BOOL EXT_CALLBACK DocSetProgressCB(pPROGRESSDATA2 pProgressData, L_VOID* pUserData) 
   if (pProgressData->Id == DOC2_PROC_FIND_ZONES) 
      MessageBox(NULL, TEXT("The current process is finding zones in a specific page."), TEXT("Notice!"), MB_OK); 
   //... Your code here 
   return TRUE; 
L_INT Doc2SetProgressCBExample(L_HDOC2 hDoc) 
   L_INT nRet; 
   nRet = L_Doc2SetProgressCB(hDoc, DocSetProgressCB, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help