DataTransfer Example for C++ 5.0 and later

void TestTwainDataTransfer(HWND hWnd)
{
   ILEADRasterTwain * pRasterTwain;

   HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&pRasterTwain);
   if (FAILED(hr) || !pRasterTwain)
   {
      ::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
      return;
   }

   pRasterTwain->EnableMethodErrors = FALSE;
   pRasterTwain->InitSession((long)hWnd);

   pRasterTwain->GetProperties();

   pRasterTwain->DataTransfer->FillOrder = L_TWBO_LSBFIRST;
   pRasterTwain->DataTransfer->BufferMemoryCompression = L_TWCP_NONE;
   pRasterTwain->DataTransfer->TransferMode = L_TWSX_MEMORY;
   pRasterTwain->DataTransfer->ScanFileFormat = L_TWFF_BMP;
   pRasterTwain->DataTransfer->MemoryBufferSize = 1024;
   pRasterTwain->DataTransfer->EnableSaveMultipageFile = FALSE;
   pRasterTwain->DataTransfer->EnableAppendToFile = FALSE;
   pRasterTwain->DataTransfer->EnableDumpMemoryBuffersToFile = TRUE;
   pRasterTwain->FileTransferName = "c:\\test.bmp";

   pRasterTwain->SetProperties();
   pRasterTwain->EndSession();
}