ImageGear for C and C++ on Linux v18.8 - Updated
IG_err_callback_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Error Functions > IG_err_callback_set

This function sets error stack callback data and functions that are called to signal error stack changes for the current thread.

Declaration:

 
Copy Code
AT_ERRCODE ACCUAPI IG_err_callback_set(
   LPVOID lpPrivate,
   LPFNIG_ERRSTACK_ADD lpfnAddCB,
   LPFNIG_ERRSTACK_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_ERRSTACK_ADD Pointer to the callback function that will be called after the record is added to the error stack. See LPFNIG_ERRSTACK_ADD for the declaration.
lpfnClearCB LPFNIG_ERRSTACK_CLEAR Pointer to the callback function that will be called after the error stack is cleared. See LPFNIG_ERRSTACK_CLEAR for the 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 ErrAdd(
    LPVOID lpPrivate,
    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 ErrClear(
    LPVOID lpPrivate,
    UINT nRecords)
{
   HWND   hWnd = (HWND)lpPrivate;
   // remove records from error window
   // ...
}

VOID Example_IG_err_callback_set()
{
    HWND hWnd = 0; // This assuming to be a real window
    AT_ERRCODE iErrCode;
    iErrCode = IG_err_callback_set((LPVOID)hWnd, ErrAdd, ErrClear);
}

Remarks:

Callback data and functions can be obtained using IG_err_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 set the thread specific callbacks. Use IG_errmngr_callback_set to set the global data and callbacks.

See Also

IG_err_callback_get