ImageGear for C and C++ on Linux v19.10 - Updated
IG_errmngr_callback_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Error Functions > IG_errmngr_callback_set

This function sets error stack callback data and functions that are called to signal error stack changes for all threads.

Declaration:

 
Copy Code
AT_ERRCODE ACCUAPI IG_errmngr_callback_set(
   LPVOID lpPrivate,
   LPFNIG_ERRMNGR_ADD lpfnAddCB,
   LPFNIG_ERRMNGR_CLEAR lpfnClearCB
);

Arguments:

Name Type Description
lpPrivate LPVOID Any Private data that will be passed to lpfnAddCB and lpfnClearCB callbacks. NULL is acceptable.
lpfnAddCB LPFNIG_ERRMNGR_ADD Callback function that will be called after the record is added to the error stack. See LPFNIG_ERRMNGR_ADD for a declaration.
lpfnClearCB LPFNIG_ERRMNGR_CLEAR Callback function that will be called after the error stack is cleared. See LPFNIG_ERRMNGR_CLEAR for a declaration.

Return Value:

Returns the code of the ImageGear error that occurred during this function call. A value of zero means no errors have occurred. Errors that occurred during this function call are not appended onto the error stack.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
VOID ACCUAPI ErrMgrRecordAdd(
   LPVOID        lpPrivate,
   DWORD            dwThreadID,
   UINT            nRecord,
    INT            iLineNumber,
    AT_ERRCODE    iCode,
    UINT            nLevel,
    AT_INT        lValue1,
    AT_INT        lValue2,
    LPCHAR        lpFileName,
    LPCHAR        lpExtratext
)
{
    HWND hWnd = (HWND)lpPrivate;
    // update error window with new records 
    // ...
}

VOID ACCUAPI ErrMgrClear(
   LPVOID        lpPrivate,
   DWORD            dwThreadID,
   UINT            nRecords)
{
    HWND hWnd = (HWND)lpPrivate;
    // remove records from error window
    // ...
}

void Example_IG_errmngr_callback_set()
{
    HWND hWnd = 0; // This assuming to be a real window
    AT_ERRCODE iErrCode;
    
    iErrCode = IG_errmngr_callback_set( (LPVOID)hWnd, ErrMgrRecordAdd, ErrMgrClear);
}

Remarks:

Global private data and callback functions can be obtained using IG_errmngr_callback_get function.

Each thread has its own independent error stack. There are two types of callbacks - local to thread and global. This API allows you to get the global (thread independent) callbacks. Use IG_err_callback_set to set the thread specific data and callbacks.