GetProperties example for Delphi
procedure TForm1.btnGetPropertiesClick(Sender: TObject);
var
nRet: L_INT;
twProps: LTWAINPROPERTIES;
begin
// Initialize to zero
FillMemory ( @twProps, sizeof(LTWAINPROPERTIES), 0 );
// Get the current properties of the selected twain source
nRet:= LEADTwain1.GetProperties ( @twProps, LTWAIN_PROPERTIES_GETCURRENT );
if ( nRet <> SUCCESS ) then
begin
Exit;
end;
// Change transfer mode to File
twProps.DataTransfer.nTransferMode:= TWSX_FILE;
StrCopy ( twProps.DataTransfer.szFileName, 'c:\temp\Twain.bmp' );
twProps.DataTransfer.nScanFileFormat:= TWFF_BMP;
// Set the new properties
LEADTwain1.EnableSetPropertiesEvent:= True;
nRet:= LEADTwain1.SetProperties ( @twProps, LTWAIN_PROPERTIES_SET );
if ( nRet <> SUCCESS ) then
begin
Exit;
end;
end;
function TForm1.LEADTwain1SetPropertiesEvent(uCap: Cardinal;
nStatus: Integer; pValue: Pointer): Integer;
begin
// Do your error notification or any other code here.
Result:= SUCCESS;
end;