The last error code in the BiTwain.ocx can be retrieved by the GetBiTwainLastError method.
The GetErrorString method can be used to get the error message associated with error code.
Please note that each OCX has a different Error code method and Error String method.
Error Code number |
Error Code |
Meaning |
0 |
TW_OK |
Operation was successful. |
1 |
TW_GENERAL_ERROR |
General internal error. |
2 |
TW_NOTOPEN |
Could not find TWAIN driver or could not load DLL. |
3 |
TW_TRANSFERFAILURE |
Data transfer failure. Possibly not enough memory. |
4 |
TW_OPENDSMFAILURE |
Could not open Data Source Manager. |
5 |
TW_COMPATIBLITY |
The TWAIN driver version is not supported. |
6 |
TW_OPENDSFAILURE |
Could not open Data Source. |
7 |
TW_CLOSEDSFAILURE |
Could not close Data Source. |
8 |
TW_SELECTDSFAILURE |
Data Source selection by the Data Source Manager failed. |
9 |
TW_NOTWAINDLL |
Twain dll is missing. |
10 |
TW_LOADED |
Twain dll is already loaded. |
11 |
TW_INVALIDPARAMETER |
Parameter is invalid. |
12 |
TW_NOTTIFFDLL |
The BiTiff.dll is missing. |
13 |
TW_FILESAVEERROR |
Error saving tiff image. |
14 |
TW_NOTDLGDLL |
BiDlgs32.dll is missing. |
15 |
TW_SUPPORT_OPERATION |
Operation is not supported. |
16 |
TW_HWND_ERROR |
Error creating window for getting event from data source. |
17 |
Black Ice specific scan settings dialog was canceled. |
In addition to the Black Ice error codes, some error messages may contain TWAIN Status Codes (Condition Codes).
These are non-Black Ice codes returned by TWAIN that give a more detailed description of the problem that can be used to debug the issue.
The latest descriptions of the Twain Condition Codes can be found in the latest Twain specification on https://twain.org/
TWAIN Condition Code |
Name |
Meaning |
0 |
TWCC_SUCCESS |
The operation was successful. |
1 |
TWCC_BUMMER |
General failure. Unload Source immediately. |
2 |
TWCC_LOWMEMORY |
Not enough memory to complete operation. |
3 |
TWCC_NODS |
The Source Manager was unable to find the specified Source. |
4 |
TWCC_MAXCONNECTIONS |
The source is connected to the maximum supported number of applications. |
5 |
TWCC_OPERATIONERROR |
Source or Source Manager reported an error to the user and handled the error; no application action is required. |
6 |
TWCC_BADCAP |
Capability not supported by Source or operation. |
9 |
TWCC_BADPROTOCOL |
Unrecognized operation triplet. |
10 |
TWCC_BADVALUE |
Data parameter out of supported range. |
11 |
TWCC_SEQERROR |
Operations out of expected sequence. Illegal operation for current Source Manager or Source state. |
12 |
TWCC_BADDEST |
Unknown destination in DSM_Entry. |
13 |
TWCC_CAPUNSUPPORTED |
Capability not supported by Source. |
14 |
TWCC_CAPBADOPERATION |
Operation (i.e., Get or Set) not supported on capability. |
15 |
TWCC_CAPSEQERROR |
The capability has dependencies on other capabilities and cannot be operated upon at this time. |
16 |
TWCC_DENIED |
File System operation is denied (file is protected). |
17 |
TWCC_FILEEXISTS |
The operation failed because the file already exists. |
18 |
TWCC_FILENOTFOUND |
File not found. |
19 |
TWCC_NOTEMPTY |
The operation failed because the directory is not empty. |
20 |
TWCC_PAPERJAM |
Transfer failed because of a feeder error. The feeder is jammed. |
21 |
TWCC_PAPERDOUBLEFEED |
Transfer failed because of a feeder error. The feeder detected multiple pages. |
22 |
TWCC_FILEWRITEERROR |
Error writing the file. (E.g.: the disk is full) |
23 |
TWCC_CHECKDEVICEONLINE |
Check the device status using CAP_DEVICEONLINE. |
24 |
TWCC_INTERLOCK |
The operation failed because the cover or door is open. |
25 |
TWCC_DAMAGEDCORNER |
The operation failed because the document has a damaged corner. |
26 |
TWCC_FOCUSERROR |
The operation failed because of a focusing error during document capture. |
27 |
TWCC_DOCTOOLIGHT |
The operation failed because the document is too light. |
28 |
TWCC_DOCTOODARK |
The operation failed because the document is too dark. |
29 |
Source has nothing to capture for a transfer. |