This might help if you are seeing “TWAIN unavailable” or “… check cables” messages.
One of the first things that CmdTwain does is initialize the scanner for the selected resolution (200 DPI by default). This triggers a lot of startup activity to get ready to be able to do that.
Internally, CmdTwain runs ScanBmp.exe. That controls the document scanner and gets images as raw bitmaps.
The action that kicks everything off in ScanBmp is a C function “CmdDPI()” which calls “CmdUnits()” and specifies “inches” (for the dots per inch that is about to happen).
CmdUnits() calls “InitTwain()” to set up the scanner connection.
If you see the “TWAIN is unavailable” message it means that the program failed to:
– Load the source manager
– – look in GetWindowsDirectory() for “TWAIN_32.DLL”
– – check that the file can be opened
– – LoadLibrary() to load the DLL into memory
– – GetProcAddress(“DSM_Entry”)
– Unload the source manager
– – This should be trivial after the above
So long as you have a TWAIN_32.DLL in your Windows directory, you should pass this step.
If you see the “… check cables” message then you passed the initial step and you do have the necessary DLL. It fails somewhere along this sequence:
– Open the default source
– – Load the source manager (it already did this so should be ok)
– – Send an OPEN DSM command to the source manager (should be fine)
– Open Data Source 0
– Set native transfer mode
The usual problem here is that the TWAIN_32.DLL tries to talk to a scanner driver which tries to talk to the scanner via a cable from the computer. You could also have a problem if:
– there isn’t a scanner driver installed.
– none of the scanner drivers is selected as the default.
– the scanner doesn’t support native mode transfers.
On my Win8.1 machine, there is a C:\Windows\twain_32 folder which contains at least one driver (wiatwain.ds). The “.ds” shows that this is a TWAIN Data Source (for Windows Imaging Architecture [wia] devices that have been set up to allow TWAIN). There is also a subdirectory (“escndv” in my case) which contains a file “nx120.ds”. I have an Epson NX120 printer/scanner attached at the moment.
I can’t get CmdTwain ver 2.01 to select a source with the scanner cable disconnected. It should be able to, so I’ll see if I can fix this in a later version (it works fine if the cables are connected). Using the IrfanView File / Select scan” option brings up the “Select Source” dialog box like this:
If you don’t see any to choose from, your scanner isn’t installed as a TWAIN device (and I’m guessing that there isn’t a driver for it in C:\Windows\twain_32 or a subdirectory).
If you do have a selected TWAIN device and your cables are connected, perhaps your scanner doesn’t support “native transfer mode”. It is far-fetched because this is the simplest mode for scanners to provide; but it is possible.