Gets the available information for the TWAIN sources installed on the system.
#include "ltwrappr.h"
virtual L_INT LTwain::GetSources (uFlags, uStructSize)
Flags that indicate what sources to get. Possible values are:
Value | Meaning |
---|---|
LTWAIN_SOURCE_ENUMERATE_ALL | [0x0000] Enumerates all the available sources. |
LTWAIN_SOURCE_ENUMERATE_DEFAULT | [0x0001] Gets only the default source (currently selected). |
Size of the LTWAINSOURCEINFO structure, in bytes, for versioning. Use sizeof(LTWAINSOURCEINFO).
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
L_INT CMyTwain::SourceInfoCallBack(pLTWAINSOURCEINFO pSourceInfo)
{
L_TCHAR szBuffer[MAX_PATH];
memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Source Name = %s\nProduct Family = %s\nManufacturer = %s\n"),
pSourceInfo->pszTwnSourceName,
pSourceInfo->pszTwnProductFamily,
pSourceInfo->pszTwnManufacturer);
MessageBox(NULL, szBuffer, TEXT("Source Info."), MB_OK);
return TWAIN_SUCCESS;
}
// initialize session and call this function
L_INT LTwain__GetSourcesExample(CMyTwain *MyClass)
{
L_INT nRet;
MyClass->EnableCallBack (TRUE);
nRet = MyClass->GetSources(LTWAIN_SOURCE_ENUMERATE_ALL , sizeof(LTWAINSOURCEINFO));
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Error during the enumeration procedure"), TEXT("ERROR"), MB_OK);
return nRet;
}
return SUCCESS;
}