CancelAcquire Example for C++ 5.0 and later
void CRasterTwainSink::OnAcquireMultiEvent(short nPage, BSTR bstrFileName, BOOL bFinishScan)
{
CString csMsg;
CString csFileName(bstrFileName);
if (bFinishScan)
{
csMsg.Format(TEXT("The page # %d was scanned and saved to file %s\n"), nPage, csFileName);
AfxMessageBox(csMsg);
}
m_pView->m_pltRasTwain->CancelAcquire();
}
ILEADRasterTwain *m_pltRasTwain;
void CTwainView::OnTestTwainAcquire()
{
short iRet;
long lSize;
m_pltRasTwain->put_FileTransferName(CString("c:\\twain.bmp").AllocSysString());
m_pltRasTwain->get_MemBufSize(&lSize);
m_pltRasTwain->put_MemBufSize (lSize * 2);
m_pltRasTwain->put_EnableAcquireMultiEvent (TRUE);
iRet = m_pltRasTwain->AcquireMulti("c:\\Twain\\test.tif", L_LTWAIN_SHOW_USER_INTERFACE, TRUE);
if (iRet != 0)
MessageBox (TEXT("Error acquiring from source"));
}