The DataSourceManagerVersion property allows you to set the Data Source Manager version that TwainPro will use. The DSM is a DLL provided by TWAIN that lives between the Data Source (Scanner) and the Application (TwainPro) and manages the data and communications between the two.
- In Versions 5 and prior of TwainPro, only Version 1 was used.
- In Version 6 of TwainPro, only Version 2 was used.
- In Version 7 of TwainPro, we introduce a new behavior to allow the DSM version used to be set, since not all scanners support the newest version of the DSM. This provides greater flexibility for the developer to accommodate such scenarios.
When set to Version 2, the file TWAINDSM.dll is used:
- 32-bit: On 64-bit machines running in a 32-bit context, it should be located in the SYSWOW64 directory. On 32-bit machines, it should be located in the SYSTEM32 directory. If it can’t be found, a TwainDllLoadException will be thrown indicating this.
- 64-bit: On 64-bit machines running in a 64-bit context, it should be located in the SYSTEM32 directory. If it can’t be found, a TwainDllLoadException will be thrown indicating this.
Also, TwainPro internally identifies itself as a 2.0 TWAIN application to the Data Source.
When set to Version 1, the file twain_32.dll is used:
- 32-bit: It should be located in the WINDOWS directory. If it can’t be found, a TwainDllLoadException will be thrown indicating this.
- 64-bit: This is not supported, you must use Version 2. (TWAIN only support 64-bit for Twain 2.0 and above.) A TwainDllLoadException will be thrown indicating this.
Also, TwainPro internally identifies itself as a 1.9 TWAIN application to the Data Source.
When set to LatestSupportedVersionAvailable:
TwainPro attempts to use Version 2 of the DSM, if this fails it will attempt to use Version 1 of the DSM. If that fails then a TwainDllLoadException will be thrown indicating no version could be found. By default the DataSourceManagerVersion property is set to LatestSupportedVersionAvailable.
DataSourceManagerVersionInUse is a read-only property that can be queried to find out the current DSM version that's currently in use by TwainPro.