L_LTKRN_API L_VOID L_SetStatusCallBack(pfnCallback, pUserData, pfnOldCallback, ppOldUserData)
Sets the new status callback function and gets the old status callback.
Pointer to your callback function. The callback function must adhere to the function syntax specified in STATUSCALLBACK Function.
This callback function must return SUCCESS if the operation was successfully done, or any error if the function call was a failure. If the callback function returns a failure, the current function will terminate and return the same error that the callback returned.
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 of the appropriate data type to access your variable or structure.
If the additional parameters are not needed, you can pass NULL in this parameter.
Pointer to a variable which will be updated with the old status callback function.
Pointer to a variable which will be updated with the user data for the old status callback function.
The status callback is returned through a parameter. You used to have to call L_GetStatusCallBack to get the user data prior to calling L_SetStatusCallback. Now you can get the old callback and set the new callback in one function call.
You can use this function to specify a callback for any of the following functions:
Both the old status callback function and the user data required for the old status callback function are updated in the
ppOldUserData parameters, respectively.
Call the L_SetStatusCallBack function, assigning its return value to a STATUSCALLBACK variable, and passing the pointer to your callback as the new value.
Call the function that uses the callback (for example L_AverageFilterBitmap.
Call the L_SetStatusCallBack function again, restoring the original value by passing the variable that you saved in Step 1.
Required DLLs and Libraries
Win32, x64, Linux.
/* This is the STATUSCALLBACK function, which stops the process if the user has pressed the interrupt key. */
L_INT EXT_CALLBACK StatusCallBack (L_INT nPercent, L_VOID *pUserData)
L_TCHAR achMsg; /* message string */
hWnd = (HWND)pUserData;
/* Let the application detect other events - good for cancel */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
/* Check the global variable and return an error if necessary */
wsprintf (achMsg, TEXT("Interrupted by the user with %d percent finished"),nPercent);
MessageBox (hWnd, achMsg, TEXT("Notice"), MB_OK);
wsprintf(achMsg, TEXT("Percentage: %d\n"), nPercent);
/* This function uses L_SetStatusCallBack to implement the STATUSCALLBACK
function when applying a median filter. */
L_INT SetStatusCallbackExample(BITMAPHANDLE *pBitmap)
STATUSCALLBACK lpfnOldStatusCB; /* Pointer to the previous STATUSCALLBACK function */
L_VOID * pOldData; /* Pointer to the user data for the previous status callback function */
/* Set the STATUSCALLBACK function, saving the pointer to the previous one */
L_SetStatusCallBack(StatusCallBack, NULL, &lpfnOldStatusCB, &pOldData );
/* Apply an intentionally slow median filter with a neighborhood of 7x7 pixels */
KillProgress = FALSE;
nRet = L_MedianFilterBitmap(pBitmap, 7, 0);
/* Restore the previous STATUSCALLBACK function */
L_SetStatusCallBack (lpfnOldStatusCB, pOldData, NULL, NULL);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries