|
Available in the LEADTOOLS Imaging toolkit. |
Acquired Bitmap 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->InitSession((long)GetSafeHwnd());
pRasterTwain->EnableMethodErrors = FALSE;
pRasterTwain->PutSaveAcquiredBitmap(TRUE);
pRasterTwain->SelectSource();
pRasterTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_MODAL_USER_INTERFACE);
//Assign all acquired bitmaps to LEAD control
m_Lead1.SetBitmapList(pRasterTwain->AcquiredBitmapList);
CString csMsg;
csMsg.Format(TEXT("Acquired bitmap list count = %d"), m_Lead1.GetBitmapListCount());
AfxMessageBox(csMsg);
// save last acquired bitmap to file
m_Lead1.SetBitmap(pRasterTwain->AcquiredBitmap);
m_Lead1.Save(TEXT("c:\\test.bmp"), FILE_TIF, 1, (QFactorConstants)0, 0);