L_DocSetProgressCB

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocSetProgressCB(hDoc, pfnCallback, pUserData)

L_HDOC hDoc;

/* handle to the OCR document */

PROGRESSCALLBACK pfnCallback;

/* callback function */

L_VOID * pUserData;

/* pointer to more parameters for the callback */

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

Parameter

Description

hDoc

Handle to the OCR document

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 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: PROGRESSCALLBACK.

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.

Returns

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 PROGRESSDATA structure, which is passed to the PROGRESSCALLBACK function.

Refer to the OCRPROCID enum for the event types that can be reported to the progress callback.

Required DLLs and Libraries

LTDOC

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:

L_DocStartUp, L_DocShutDown, PROGRESSCALLBACK

Topics:

OCR Functions: Starting and Shutting Down

 

Starting and Shutting Down the Engine

Example

L_BOOL EXT_CALLBACK DocSetProgressCB(pPROGRESSDATA pProgressData, L_VOID* pUserData)
{
   UNREFERENCED_PARAMETER(pUserData);

   if (pProgressData->Id == 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 DocSetProgressCBExample(L_HDOC hDoc)
{
   L_INT nRet;
   nRet = L_DocSetProgressCB(hDoc, DocSetProgressCB, NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}