LTwain::GetSources

#include "ltwrappr.h"

virtual L_INT LTwain::GetSources (uFlags, uStructSize)

L_UINT uFlags;

/* optional flags */

L_UINT uStructSize;

/* size of the LTWAINSOURCEINFO structure, in bytes */

Gets the available information for the TWAIN sources installed on the system.

Parameter

Description

uFlags

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).

uStructSize

Size of the LTWAINSOURCEINFO structure, in bytes, for versioning. Use sizeof(LTWAINSOURCEINFO).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LTwain::SelectSource, LTwain::SourceInfoCallBack

Topics:

Managing the TWAIN Source

 

TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain
{
public:
   L_INT SourceInfoCallBack(pLTWAINSOURCEINFO pSourceInfo);
};

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_VOID TwainGetAvailableSources (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); 
}