L_Doc2SetProgressCBExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2SetProgressCBExt(hDoc, nDocId, 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.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

PROGRESSCALLBACK2 pfnCallback

Optional callback function for reporting progress of a specific operation.

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

The OCR engine calls L_Doc2SetProgressCBExt as it reports the progress of a specific operation. L_Doc2SetProgressCBExt 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 pUserData, 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, pass NULL in pUserData.

Returns

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

Comments

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

Functions

Topics

Example

L_BOOL EXT_CALLBACK DocSetProgressCBExt(pPROGRESSDATA2 pProgressData, L_VOID* pUserData) 
{ 
   UNREFERENCED_PARAMETER(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 Doc2SetProgressCBExampleExt(L_HDOC2 hDoc, L_INT nDocId) 
{ 
   L_INT nRet; 
   nRet = L_Doc2SetProgressCBExt(hDoc, nDocId, DocSetProgressCBExt, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help