LEADTOOLS OCR C DLL Help > Function References > OCR Professional > L_Doc2SetProgressCB |
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2SetProgressCB(hDoc, pfnCallback, pUserData)
L_HDOC2 hDoc; |
/* handle to the OCR document */ |
PROGRESSCALLBACK2 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 opportunity 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: PROGRESSCALLBACK2. |
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 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
LTDOC2 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: |
|
Topics: |
|
|
Example
L_BOOL EXT_CALLBACK DocSetProgressCB(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_LTDOC2TEX_API L_INT Doc2SetProgressCBExample(L_HDOC2 hDoc) { L_INT nRet; nRet = L_Doc2SetProgressCB(hDoc, DocSetProgressCB, NULL); if(nRet != SUCCESS) return nRet; return SUCCESS; }