Home › Forums › TWAIN Classic › Gurus HELP please with SelectSource() › Reply To: Gurus HELP please with SelectSource()
August 11, 2008 at 12:19 pm #24609
I found my error.
Post the fixed code for future references.
BOOL CTwain::SelectSource2()
{
memset(&m_Source,0,sizeof(m_Source));
// add your header file /////////////////////////////////////////
TW_IDENTITY m_SourceList[256];
UINT m_nSources;
/////////////////////////////////////////////////////////////////
memset(m_SourceList, 0, 256 * sizeof(TW_IDENTITY));
m_nSources = 0;
if (CallTwainProc(&m_AppId, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETFIRST, m_SourceList))
{
m_nSources++;
for (int i = 1 ; i < 256 ; i++)
{
char * pch;
char * modeloScanner = "FUJITSU";
pch = strtok(m_SourceList[i-1].ProductName,modeloScanner );
if (pch != NULL )
{
m_Source = m_SourceList[i-1];
m_bSourceSelected = TRUE;
return TRUE;
}
if (CallTwainProc(&m_AppId, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETNEXT, &m_SourceList))
{
m_nSources++;
}
if (m_returnCode == TWRC_ENDOFLIST)
{
return TRUE;
}
}
}
else
{
return FALSE;
}
return TRUE;
}