1) Download Source code from - https://sites.google.com/site/eduardfilefepositore/
2) Open ScannerAdapterFactory.cs
3) Check Below Method and update according to your situation
public static ScannerAdapterBase GetScannerAdapter(nessScanning control, IMessageFilter messageFilter, IntPtr handle)
{
lock (locker)
{
bool isWiaDeviceSelected = false;
bool isTwainDeviceSelected = false;
if (m_ScannerAdapterBase != null)
{
return m_ScannerAdapterBase;
}
try
{
//commented by shekhar 6/2/2015 - If you want to use WIA then uncomment this
//Checks WIA Devices
//m_ScannerAdapterBase = new WiaScannerAdapter();
//m_ScannerAdapterBase.InitAdapter(control, messageFilter, handle);
//isWiaDeviceSelected = m_ScannerAdapterBase.SelectDevice();
//if (isWiaDeviceSelected)
//{
// return m_ScannerAdapterBase;
//}
//end of commented by shekhar 6/2/2015 - If you want to use WIA then uncomment this
//Checks TWAIN Devices
m_ScannerAdapterBase = new TwainScannerAdapter();
m_ScannerAdapterBase.InitAdapter(control, messageFilter, handle);
isTwainDeviceSelected = m_ScannerAdapterBase.SelectDevice();
if (isTwainDeviceSelected)
{
return m_ScannerAdapterBase;
}
}
catch (ScannerException ex)
{
throw ex;
}
return null;
}
}
2) Open ScannerAdapterFactory.cs
3) Check Below Method and update according to your situation
public static ScannerAdapterBase GetScannerAdapter(nessScanning control, IMessageFilter messageFilter, IntPtr handle)
{
lock (locker)
{
bool isWiaDeviceSelected = false;
bool isTwainDeviceSelected = false;
if (m_ScannerAdapterBase != null)
{
return m_ScannerAdapterBase;
}
try
{
//commented by shekhar 6/2/2015 - If you want to use WIA then uncomment this
//Checks WIA Devices
//m_ScannerAdapterBase = new WiaScannerAdapter();
//m_ScannerAdapterBase.InitAdapter(control, messageFilter, handle);
//isWiaDeviceSelected = m_ScannerAdapterBase.SelectDevice();
//if (isWiaDeviceSelected)
//{
// return m_ScannerAdapterBase;
//}
//end of commented by shekhar 6/2/2015 - If you want to use WIA then uncomment this
//Checks TWAIN Devices
m_ScannerAdapterBase = new TwainScannerAdapter();
m_ScannerAdapterBase.InitAdapter(control, messageFilter, handle);
isTwainDeviceSelected = m_ScannerAdapterBase.SelectDevice();
if (isTwainDeviceSelected)
{
return m_ScannerAdapterBase;
}
}
catch (ScannerException ex)
{
throw ex;
}
return null;
}
}
No comments:
Post a Comment