Duplex Options Example for C++ 5.0 and later

ILEADRasterTwain_U * pRasterTwain;

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

VARIANT_BOOL bEnableDuplex;
short nDuplexMode;
short nMaxXfer;

pRasterTwain->InitSession((long)GetSafeHwnd());
pRasterTwain->SelectSource();
pRasterTwain->get_EnableDuplex (&bEnableDuplex);
pRasterTwain->get_DuplexMode (&nDuplexMode);
pRasterTwain->get_MaxXferCount (&nMaxXfer);

if (bEnableDuplex != TRUE)
{
  pRasterTwain->put_EnableDuplex (TRUE);
  pRasterTwain->put_DuplexMode(L_TWDX_1PASSDUPLEX);
}

if (nMaxXfer != 10)
	pRasterTwain->put_MaxXferCount (10);