Acquire example for C++ Builder
int __fastcall TForm1::LEADTwain1AcquirePageEvent(TBITMAPHANDLE Bitmap)
{
if ( Bitmap != NULL )
LEADImage1->Bitmap= Bitmap;
return SUCCESS;
}
void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
L_INT nRet;
TW_CAPABILITY twCap;
// Show the Twain Select Source UI
nRet= LEADTwain1->SelectSource ( );
if ( nRet != SUCCESS )
MessageBox ( Handle, "Error occurred while selecting the source.", "ERROR", MB_OK );
twCap.Cap= ICAP_XFERMECH;
twCap.ConType= TWON_ONEVALUE;
LEADTwain1->CreateNumericContainerOneValue ( &twCap, TWAINNUMERICTYPE_TW_UINT16, TWSX_NATIVE );
LEADTwain1->SetCapability ( &twCap, LTWAIN_CAPABILITY_SET );
LEADTwain1->FreeContainer ( &twCap );
LEADTwain1->EnableAcquirePageEvent = True;
nRet= LEADTwain1->Acquire ( LTWAIN_SHOW_USER_INTERFACE );
if ( nRet == SUCCESS )
MessageBox ( Handle, "The image acquisition process completed.", "Notice", MB_OK );
else
MessageBox ( Handle, "The image acquisition process failed!", "Error", MB_OK );
}