Successful running of the DTWAIN application

Top  Previous  Next

For your application to run successfully, you must make sure the DTWAIN dynamic link library itself is located somewhere on the system path, or in your application directory 

(there are other places where the DLL can be located, but that is beyond the scope of this introduction -- please refer to the following link).


In addition to the DLL files, the text resource files must also be available (by default, they should reside in the same directory as the DLL files above).  


Make sure that you are running the latest version of the text resources, as changes to these files can affect how your application will run when using future versions of DTWAIN. The simplest 

way to ensure that you are running the latest version is to always get these resources whenever you use a newer release of the DTWAIN DLL's.  


The mandatory text resource file is twaininfo.txt.  This file is required as it contains all the information concerning the naming of the TWAIN capabilities, triplet information, etc. 

You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed.


If twaininfo.txt file is not found, you will receive the following error when running your application;



Note: If your application wants to suppress the above message box, but still receive an error return code, your application should issue a call to the API function 

DTWAIN_SysInitializeNoBlocking instead of DTWAIN_SysInitialize If DTWAIN_SysInitializeNoBlocking returns a 0 or null handle, a subsequent call to 

DTWAIN_GetLastError will return -1051, indicating that the DTWAIN resources were not loaded.


Note: Make sure that you use the latest version of the text resources. A check for the resource version is done by DTWAIN when DTWAIN_SysInitialize is called. 

If DTWAIN detects that the resources are corrupted or out-of-date, DTWAIN_SysInitialize will return a NULL handle indicating an error.



In addition, there are optional string resource files available. Here are a list of those files:


twainresourcestrings_english.txt      

twainresourcestrings_dutch.txt        

twainresourcestrings_french.txt       

twainresourcestrings_german.txt       

twainresourcestrings_italian.txt      

twainresourcestrings_spanish.txt      

twainresourcestrings_portuguese_br.txt

twainresourcestrings_romanian.txt     

twainresourcestrings_russian.txt      


These files control the language used when reporting errors and logging information when using DTWAIN.


If you want to use a different resource file or even add your own language resource, it is recommended you copy the file in question, rename the file, make the changes required, 

and then utilize the new file by calling the DTWAIN_LoadCustomStringResources API function.


More detailed instructions on adding your own resource file can be found here.