General DTWAIN Questions
Q: I called a DTWAIN function, but I'm always getting a FALSE return code. DTWAIN_GetLastError returns a DTWAIN_ERR_BAD_HANDLE. What's wrong? A: You either did not call DTWAIN_SysInitialize, or you called DTWAIN_SysDestroy without calling DTWAIN_SysInitialize again.
Q: What will happen if I don't call DTWAIN_SysDestroy? A: Bad things! The DTWAIN_SysDestroy function is responsible for unloading TWAIN successfully. If this is not done, the underlying TWAIN environment may become unstable for any application that will use TWAIN. For Windows 3.x, you may have to restart the Windows environment. For Windows 95, a reboot may be necessary. For Windows NT, you may be able to stabilize the system by bringing up the Task Manager and killing any instances of TWUNK_16.EXE or TWUNK_32.EXE (the TWAIN thunking programs). You may also have to kill any programs that start particular Source user interfaces.
Q: What if my application terminates unexpectedly (for example, a General Protection Fault) before calling DTWAIN_SysDestroy? A: Currently DTWAIN does not check if the application has unexpectedly terminated. What may occur is that your device's driver files, DLL's, executables, etc. are still loaded and may need to be terminated manually (using the Windows Task Manager). You will need to identify which executables or services need to be terminated that were started by your device to set your TWAIN device "back to normal" if there is an unexpected crash.
Q: How do I select a Source without showing the TWAIN Select Source dialog? A: Use DTWAIN_SelectDefaultSource or DTWAIN_SelectSourceByName
Q: When I attempt to open a Source, it takes a long time for the Source to respond. Why? A: Some Sources query the hardware to make sure that the device is physically present before opening the Source. Other Sources just check if the device's software is installed. Another reason is that DTWAIN tries to gather Source capability information if the Source can be opened.
Q: The error messages are in English when I call DTWAIN_GetErrorString. How do I get them to be in the native language? A: In the DTWAIN32.INI file, there is a section called "[Language]". The item "DLL=" sets the DTWAIN language DLL to use for error messages. If the DTWAIN32.INI file is not found, or if the [Language] setting is missing or wrong, DTWAIN defaults to the English error messages. An alternative is to call DTWAIN_LoadLanguageResource to load the correct language resource at run-time.
Q: Do DTWAIN_ARRAYs, DTWAIN_RANGEs and DTWAIN_FRAMEs have to be destroyed by the application? A: Currently the only function that releases the memory allocated for any of these DTWAIN types is DTWAIN_SysDestroy, DTWAIN_ArrayDestroy, DTWAIN_RangeDestroy, or DTWAIN_FrameDestroy.
Q: I called DTWAIN_SysDestroy and all of my DTWAIN_ARRAYs are invalid. What happened? A: When DTWAIN_SysDestroy is called, the DTWAIN_ARRAY's, DTWAIN_RANGES, and DTWAIN_FRAMEs become invalid. They can no longer be used, since DTWAIN manages the memory allocated for these data types. |