This code segment scans all pages in the ADF to a multipage file while displaying each page.
void CNewscanDlg::OnDisplayAndFile()
{
ImgScan1.SetScanTo (1); // DisplayAndFile
// Set the image property to a file name.
ImgScan1.SetImage ("D:\\image2\\newpages.tif");
// Multipage must be true in order to create files with
// more than one page.
ImgScan1.SetMultiPage (TRUE);
// Do not show the scanner's TWAIN UI.
ImgScan1.SetShowSetupBeforeScan (FALSE);
// Scan without using dialog box.
ImgScan1.StartScan();
}