GetScanConfigs Example for C++ 5.0 and later

ILEADRasterTwain_U * pRasterTwain;
short iRet;
CString csStr;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain_U, NULL, CLSCTX_ALL, IID_ILEADRasterTwain_U, (void **)&pRasterTwain);

pRasterTwain->InitSession((long)GetSafeHwnd()); 
pRasterTwain->SelectSource();
iRet = pRasterTwain->GetScanConfigs(1, L_LTWAIN_BUFFER_MODE, 5);
if (iRet == 0)
{
	MessageBox(TEXT("GetScanConfigs method was successful"), ("Notice"), MB_OK);

	csStr.Format(TEXT("Scan Configuration count = %d") + pRasterTwain->ScanConfigCount);
	MessageBox(csStr, TEXT("Notice"), MB_OK);

	csStr.Format(TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"), pRasterTwain->ScanConfig[0]->TransferMode, pRasterTwain->ScanConfig[0]->FileFormat, pRasterTwain->ScanConfig[0]->BufferSize, pRasterTwain->ScanConfig[0]->RequiredTime);

	MessageBox(csStr, TEXT("Scan Configurations..."), MB_OK);
}
else
	MessageBox(TEXT("Error occurred in GetScanConfigs method!!!"), TEXT("Error!!!"), MB_OK);