ImageResolution 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;
}

pRasterTwain->EnableMethodErrors = FALSE;
pRasterTwain->InitSession((long)GetSafeHwnd()); 
pRasterTwain->SelectSource();

pRasterTwain->GetProperties();

pRasterTwain->ImageResolution->Unit = L_TWUN_INCHES;
pRasterTwain->ImageResolution->BitsPerPixel = 1;
pRasterTwain->ImageResolution->HorizontalResolution = 150;
pRasterTwain->ImageResolution->VerticalResolution = 150;
pRasterTwain->ImageResolution->XScaling = 1;
pRasterTwain->ImageResolution->YScaling = 1;
pRasterTwain->ImageResolution->RotationAngle = 90;

pRasterTwain->LeftMargin = 0;
pRasterTwain->RightMargin = 0;
pRasterTwain->TopMargin = 200;
pRasterTwain->BottomMargin = 200;

pRasterTwain->EnableAutoFeed = TRUE;
pRasterTwain->MaxPagesNumber = -1;

char buf[256];

memset(buf, 0, strlen(buf));
wsprintf(buf, TEXT("Duplex state = %d"), pRasterTwain->DuplexScanning);
::MessageBox(NULL, buf, "Duplex", MB_OK);

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