DTWAIN Error Constants

Top  Previous  Next

The DTWAIN_GetLastError function returns the last DTWAIN error that occurred.  The following values are the various DTWAIN specific error codes.

 

The actual numerical values of these return codes can be found in the DTWAINDEFS.H header file.  Note that the numerical values may change from one version of DTWAIN to another, so it is best to rely on the names below, and not the actual error number.  To retrieve the error as a string, call DTWAIN_GetErrorString (note that you need the correct DTW*.L32 language DLL installed to see any of the error messages when calling DTWAIN_GetErrorString)

 

Error Code

Definition

Value




DTWAIN_ERR_BAD_HANDLE                        

DTWAIN DLL not initialized

-1001

DTWAIN_ERR_BAD_SOURCE                

Invalid DTWAIN_SOURCE

-1002

DTWAIN_ERR_BAD_ARRAY                

Invalid DTWAIN_ARRAY

-1003

DTWAIN_ERR_WRONG_ARRAY_TYPE        

Wrong DTWAIN_ARRAY data type

-1004

DTWAIN_ERR_INDEX_BOUNDS        

DTWAIN_ARRAY index invalid

-1005

DTWAIN_ERR_OUT_OF_MEMORY        

Insufficient memory

-1006

DTWAIN_ERR_NULL_WINDOW                

The HWND is NULL

-1007

DTWAIN_ERR_BAD_PIXTYPE                

Incorrect Pixel Type was chosen

-1008

DTWAIN_ERR_BAD_CONTAINER

Invalid DTWAIN Container

-1009

DTWAIN_ERR_NO_SESSION

TWAIN Session was not started

-1010

DTWAIN_ERR_BAD_ACQUIRE_NUM

Acquisition out of sequence

-1011

DTWAIN_ERR_BAD_CAP                        

Unknown capability was specified

-1012

DTWAIN_ERR_CAP_NO_SUPPORT        

The capability is not supported

-1013

DTWAIN_ERR_TWAIN                        

The error is a TWAIN error

-1014

DTWAIN_ERR_BAD_FILENAME                

Invalid file name was specified

-1016

DTWAIN_ERR_EMPTY_ARRAY

DTWAIN_ARRAY has no elements

-1017

DTWAIN_ERR_FILE_FORMAT                

Invalid graphics file format

-1018

DTWAIN_ERR_BAD_DIB_PAGE        

Invalid DIB page number

-1019

DTWAIN_ERR_SOURCE_ACQUIRING        

Source is acquiring an image

-1020

DTWAIN_ERR_INVALID_PARAM                

Invalid parameter in function call

-1021

DTWAIN_ERR_INVALID_RANGE                

Invalid DTWAIN_RANGE

-1022

DTWAIN_ERR_UI_ERROR                                

Error in displaying Source User Interface

-1023

DTWAIN_ERR_BAD_UNIT                

Invalid Source unit of measure specified

-1024

DTWAIN_ERR_LANGDLL_NOT_FOUND                

DTWAIN Language DLL not found

-1025

DTWAIN_ERR_SOURCE_NOT_OPEN                

Source is not open.

-1026

DTWAIN_ERR_DEVICEEVENT_NOT_SUPPORTED

External device events not supported

-1027

DTWAIN_ERR_UIONLY_NOT_SUPPORTED        

UI only for Source not supported

-1028

DTWAIN_ERR_UI_ALREADY_OPENED                

Source UI already opened

-1029

DTWAIN_ERR_CAPSET_NOSUPPORT          

Capability cannot be set.

-1030

DTWAIN_ERR_NO_FILE_XFER                

Source has no file transfer support.

-1031

DTWAIN_ERR_INVALID_BITDEPTH

Bit depth invalid

-1032

DTWAIN_ERR_NO_CAPS_DEFINED        

Source has no capabilities

-1033

DTWAIN_ERR_TILES_NOT_SUPPORTED                

Tiled data transfer not supported

-1034

DTWAIN_ERR_INVALID_DTWAIN_FRAME        

DTWAIN_FRAME invalid

-1035

DTWAIN_ERR_LIMITED_VERSION

Function not supported in free DTWAIN version

-1036

DTWAIN_ERR_NO_FEEDER

Source does not support a document feeder

-1037

DTWAIN_ERR_NO_FEEDER_QUERY        

Source cannot detect documents in feeder.

-1038

DTWAIN_ERR_EXCEPTION_ERROR        

A TWAIN DSM exception occurred.

-1039

DTWAIN_ERR_INVALID_STATE

Cannot call DTWAIN Function in current TWAIN State

-1040

DTWAIN_ERR_UNSUPPORTED_EXTINFO

Unsupported Extended Information Type

-1041

DTWAIN_ERR_DLLRESOURCE_NOTFOUND

The specified DTWAIN Resource DLL could not be found

-1042

DTWAIN_ERR_NOT_INITIALIZED

DTWAIN was not initialized successfully

-1043

DTWAIN_ERR_NO_SOURCES

No TWAIN Sources were found

-1044

DTWAIN_ERR_TWAIN_NOT_INITIALIZED

Could not start TWAIN Session

-1045

DTWAIN_ERR_WRONG_THREAD

Calling DTWAIN function in an invalid thread

-1046

DTWAIN_ERR_BAD_CAPTYPE

Capability data type is invalid.

-1047

DTWAIN_ERR_UNKNOWN_CAPDATATYPE

Data type for specified capability is unknown

-1048

 

 

The following errors can occur when acquiring files or using the OCR engine

 

Error Code

Definition

Value




DTWAIN_ERR_MEM                

Insufficient memory for image file

-2001

DTWAIN_ERR_FILEOPEN        

Could not open image file

-2002

DTWAIN_ERR_FILEWRITE                

Could not write image file

-2004

DTWAIN_ERR_BADPARAM

Bad parameter sent to image file functions

-2005

DTWAIN_ERR_INVALIDBMP        

Invalid bitmap

-2006

DTWAIN_ERR_INVALIDJPG        

Invalid JPEG file

-2009

DTWAIN_ERR_DC                        

Invalid device context

-2010

DTWAIN_ERR_DIB                

Invalid DIB (Device Independent Bitmap)

-2011

DTWAIN_ERR_INVALIDPNG        

Invalid PNG file

-2015

DTWAIN_ERR_PNGCREATE        

Could not create PNG file

-2016

DTWAIN_ERR_INVALIDTIFF        

Invalid TIFF file

-2020

DTWAIN_ERR_NOTIFFLZW        

LZW compression not supported

-2021

DTWAIN_ERR_INVALIDPCX        

Invalid PCX file

-2022

DTWAIN_ERR_CREATEBMP                        

Could not create BMP file

-2023

DTWAIN_ERR_GETDIB                        

Could not retrieve DIB

-2025

DTWAIN_ERR_INVALIDWMF                

Invalid Windows Meta file

-2027

DTWAIN_ERR_DEPTHMISMATCH        

Invalid bit depth

-2028

DTWAIN_ERR_BITBLT                        

BilBlt failure

-2029

DTWAIN_ERR_BUFTOOSMALL                

Image buffer too small

-2030

DTWAIN_ERR_TOOMANYCOLORS                

Image contains too many colors

-2031

DTWAIN_ERR_INVALIDTGA                

Invalid TGA file

-2032

DTWAIN_ERR_CREATEDIB                

DIB could not be created

-2035

DTWAIN_ERR_NOLZW                

No LZW compression

-2036

DTWAIN_ERR_SETWINMETAFILEBITS        

Error in setting meta file bits

-2041

DTWAIN_ERR_GETWINMETAFILEBITS                

Error in getting meta file bits

-2042

DTWAIN_ERR_INVALIDPSD                

Invalid PSD file

-2046

DTWAIN_ERR_PSDNOTSUPPORTED        

PSD file not supported

-2047

DTWAIN_ERR_NOTIFFTAG        

Invalid TIFF tag

-2054

DTWAIN_ERR_TIFFDLL16NOTFOUND        

TIFLIB16.DLL could not be found

-2059

DTWAIN_ERR_PNGDLL16NOTFOUND        

PNGLIB16.DLL could not be found

-2060

DTWAIN_ERR_JPEGDLL16NOTFOUND        

JPGLIB16.DLL could not be found

-2061

DTWAIN_ERR_BADBITSPERPIXEL

Invalid bits-per-pixel

-2062

DTWAIN_ERR_TIFFDLL32INVALIDVER

DTWIMG32.DLL invalid

-2063

DTWAIN_ERR_PDFDLL32NOTFOUND

DTWPDF32.DLL not found

-2064

DTWAIN_ERR_PDFDLL32INVALIDVER

DTWPDF32.DLL invalid

-2065

DTWAIN_ERR_JPEGDLL32NOTFOUND

DTWIMG32.DLL not found

-2066

DTWAIN_ERR_JPEGDLL32INVALIDVER

DTWIMG32.DLL invalid

-2067

DTWAIN_ERR_PNGDLL32NOTFOUND

DTWIMG32.DLL not found

-2068

DTWAIN_ERR_PNGDLL32INVALIDVER

DTWIMG32.DLL invalid

-2069

DTWAIN_ERR_J2KDLL32NOTFOUND

DTWIMG32.DLL not found

-2070

DTWAIN_ERR_J2KDLL32INVALIDVER

DTWIMG32.DLL invalid

-2071

DTWAIN_ERR_MANDUPLEX_UNAVAILABLE

Manual Duplex mode is unavailable

-2072

DTWAIN_ERR_TIMEOUT

Timeout reached when attempting to communicate with TWAIN

-2073

DTWAIN_ERR_INVALIDICONFORMAT

Invalid format specified for ICON files

-2074

DTWAIN_ERR_TWAIN32DSMNOTFOUND

TWAIN_32.DLL was not found, could not be opened, or is corrupted.

-2075

DTWAIN_ERR_TWAINOPENSOURCEDSMNOTFOUND

TWAINDSM.DLL was not found, could not be opened, or is corrupted.

-2076

DTWAIN_ERR_TS_NOFILENAME

No file name specified when calling DTWAIN_TwainSave

-2081

DTWAIN_ERR_TS_NOTWAINSYS

TWAIN not installed when calling DTWAIN_TwainSave

-2082

DTWAIN_ERR_TS_DEVICEFAILURE

TWAIN device failure when calling DTWAIN_TwainSave

-2083

DTWAIN_ERR_TS_FILESAVEERROR

Error saving file name when DTWAIN_TwainSave is used

-2084

DTWAIN_ERR_TS_COMMANDILLEGAL

Illegal command string used for DTWAIN_TwainSave

-2085

DTWAIN_ERR_TS_CANCELLED

User cancelled TWAIN acquisition (DTWAIN_TwainSave)

-2086

DTWAIN_ERR_TS_ACQUISITIONERROR

Acquisition error when using DTWAIN_TwainSave

-2087

DTWAIN_ERR_TS_INVALIDCOLORSPACE

Unsupported color space when using DTWAIN_TwainSave

-2088

DTWAIN_ERR_TS_PDFNOTSUPPORTED

PDF file acquisition not supported for DTWAIN_TwainSave

-2089

DTWAIN_ERR_TS_NOTAVAILABLE

DTWTS.DLL not found.  Required for DTWAIN_TwainSave

-2090

DTWAIN_ERR_OCR_INVALIDPAGENUM

Invalid image page number specified.

-2100

DTWAIN_ERR_OCR_INVALIDENGINE

Invalid OCR engine specified

-2101

DTWAIN_ERR_OCR_NOTACTIVE

OCR Engine not active

-2102

DTWAIN_ERR_OCR_INVALIDFILETYPE

Invalid image file type specified when using OCR

-2103

DTWAIN_ERR_OCR_INVALIDPIXELTYPE

Invalid pixel type specified when using OCR

-2104

DTWAIN_ERR_OCR_INVALIDBITDEPTH

Invalid bit depth specified when using OCR

-2105

DTWAIN_ERR_OCR_RECOGNITIONERROR

OCR engine image recognition failed

-2106




 

 

-

 

The list of TWAIN specific errors are defined below:

 

Error Code                                        

Definition

Value




TWAIN_ERR_LOW_MEMORY                

Insufficient memory

-1100

TWAIN_ERR_FALSE_ALARM        

No error could be detected.

-1101

TWAIN_ERR_BUMMER                

Operation not completed

-1102

TWAIN_ERR_NODATASOURCE                

There are no Sources.

-1103

TWAIN_ERR_MAXCONNECTIONS        

Source already connected.

-1104

TWAIN_ERR_OPERATIONERROR                

Internal TWAIN Error.

-1105

TWAIN_ERR_BADCAPABILITY                

Invalid capability.

-1106

TWAIN_ERR_BADVALUE                                

Parameter out of range

-1107

TWAIN_ERR_BADPROTOCOL                

Bad TWAIN triplet

-1108

TWAIN_ERR_SEQUENCEERROR                

TWAIN triplet out of sequence.

-1109

TWAIN_ERR_BADDESTINATION                

Bad app in DSM entry function

-1110

TWAIN_ERR_CAPNOTSUPPORTED        

Unsupported capability.

-1111

TWAIN_ERR_CAPBADOPERATION                

Unsupported operation

-1112

TWAIN_ERR_CAPSEQUENCEERROR        

Capability Sequence error.

-1113

TWAIN_ERR_FILEPROTECTEDERROR                

File is protected

-1114

TWAIN_ERR_FILEEXISTERROR                

File already exists

-1115

TWAIN_ERR_FILENOTFOUND                

File not found

-1116

TWAIN_ERR_DIRNOTEMPTY                

Directory not empty

-1117

TWAIN_ERR_FEEDERJAMMED                

Feeder jammed

-1118

TWAIN_ERR_FEEDERMULTPAGES        

Multiple pages in feeder

-1119

TWAIN_ERR_FEEDERWRITEERROR        

Error writing image

-1120

TWAIN_ERR_DEVICEOFFLINE                

Device is off-line

-1121

TWAIN_ERR_NULL_CONTAINER                

Capability has no container defined

-1122