ImageGear Professional DLL v18.1 for Windows
IG_error_get
Send Feedback
ImageGear Professional v18.1 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Error Functions > IG_error_get

Glossary Item Box

This function retrieves an ImageGear Error Code and associated information from the error stack.

Declaration:

  Copy Code
VOID ACCUAPI IG_error_get(
   INT iErrorIndex,
   LPSTR szFileName,
   INT cbFileNameSize,
   LPINT lpiLineNumber,
   LPAT_ERRCODE lpiCode,
   LPAT_INT lplValue1,
   LPAT_INT lplValue2
);

Arguments:

Name Type Description
iErrorIndex INT Tells which error to fetch from stack. A value of 0 means fetch the first error placed on the stack.
szFileName LPSTR Pointer indicating where to return the module name in which this error occurred. If this pointer is NULL, the module name is not returned.
cbFileNameSize INT Number of bytes available in byte array pointed to by szFileName.
lpiLineNumber LPINT Pointer indicating where to return the line number at which the error occurred. If NULL, the line number is not returned.
lpiCode LPAT_ERRCODE Pointer indicating where to return the Error Code. If NULL, the Error Code is not returned.
lplValue1 LPAT_INT Pointer indicating where to return a value stored as lValue1 when the error occurred. If NULL, this value is not returned. See Remarks below for explanation of lValue1 and lValue2.
lplValue2 LPAT_INT Pointer indicating where to return a value stored as lValue2 when the error occurred. If NULL, this value is not returned. See Remarks below for explanation of lValue1 and lValue2.

Return Value:

None

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

MFC Threads, MFC

Example:

  Copy Code
INT       i;                // Will hold Loop Index and Error Index
INT      iLineNumber;        // Will hold returned Line Number
BYTE     szFileName[30];    // Will hold ret'd module name, up to 29 chars
INT      cbFileNameSize;    // Will hold size of szFileName array
AT_INT     lValue1, lValue2;// Will hold returned lValue1, lValue2
AT_ERRCODE  iCode;            // Will hold returned ImageGear Error Code
AT_ERRCOUNT  nErrcount;        // Will hold count of errors on error stack
TCHAR szBuf[60];            // Will hold zero-terminated string returned by wsprintf() below
cbFileNameSize = 30;        // Size of module-name array
nErrcount = IG_error_check(); // Get number of errors on stack
for ( i = 0;  i < nErrcount;  i++ )
{
    // Get Module Name, Line Number, Error Code, and lValue1, lValue2:
    IG_error_get ( i, (LPSTR) &szFileName, 
            cbFileNameSize, &iLineNumber, (LPAT_ERRCODE)&iCode, 
            (LPAT_INT) &lValue1, (LPAT_INT) &lValue2 );
    // Format error message in szBuf:
    wsprintf ( szBuf, _T("Error %d in Module %s at Line %d"), iCode, szFileName, iLineNumber );
    // Display error message in a Message Box, with heading "Error" :
    MessageBox ( NULL, szBuf, _T("Error"), MB_OK );
}
IG_error_clear(); // Done getting errors, clear the error stack

Remarks:

Set iErrorIndex to indicate which error to get. iErrorIndex = 0 means the error added to the stack first. The other arguments (except cbFileNameSize) are pointers telling this function where to return the retrieved information to you. This information consists of the Error Code, the module name and line number at which the error occurred, and two additional values (lValue1 and lValue2) which may provide additional information about the error. See Function Error Return Codes for a list of all ImageGear Error Codes and the significance of lValue1, lValue2 where applicable.

To determine the number of errors currently on the error stack use IG_error_check. After fetching all error information you need using IG_error_get, use IG_error_clear to clear the stack.

A call to this function has the same effect as a call to IG_err_error_get with nLevel equal to 0 and lpExtraText equal to NULL.

©2014. Accusoft Corporation. All Rights Reserved.