Automatic Error Reporting |
Top Previous Next |
By default, when you run a DTWAIN application, any errors that DTWAIN discovers are returned to the application. The application then retrieves the error by calling DTWAIN_GetLastError.
DTWAIN has another option of reporting errors. This option will display an error message box whenever DTWAIN detects an error. This allows you to develop an application with DTWAIN, and flush out any problems automatically, without having to check for return codes. For example, here is what is shown if you happen to call DTWAIN_OpenSource with an invalid Source handle:
To turn on this feature, you can do one of two methods:
[DSMErrorLogging] DisplayLibErrors=1
If the DisplayLibErrors entry is set to 1, the message box will be used to report errors. If it is set to 0, no message box is used.
In addition to DTWAIN errors, exception errors (errors that more than likely would cause your program to crash) can also be reported. To do this, the DTWAIN_LOG_SHOWEXCEPTIONS flag must be set when DTWAIN_SetTwainLog is called, or the ShowExceptions entry in the DSMErrorLogging section of DTWAIN32.INI must be set to 1.
|