Acquire example for Delphi
Function TForm1.LEADTwain1AcquirePageEvent(Bitmap: TBITMAPHANDLE): Integer;
begin
if ( Bitmap <> 0 ) then
LEADImage1.Bitmap:= Bitmap;
Result:= SUCCESS;
end;
procedure TForm1.btnAcquireClick(Sender: TObject);
var
nRet: L_INT;
twCap: TW_CAPABILITY;
begin
// Show the Twain Select Source UI
nRet:= LEADTwain1.SelectSource ( );
if ( nRet <> SUCCESS ) then
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 ) then
MessageBox ( Handle, 'The image acquisition process completed.', 'Notice', MB_OK )
else
MessageBox ( Handle, 'The image acquisition process failed!', 'Error', MB_OK );
end;