Delphi Sample: Acquire and save to BMP file
The following Delphi example all that is required to do the following:
___________________________________________________________ procedure TForm1.Acquire(Sender: TObject); var SelectedSource: DTWAIN_SOURCE; ErrStatus: DWORD; AcquiredOk:DTWAIN_BOOL;
begin { Check for TWAIN availability } if (DTWAIN_IsTwainAvailable) then begin
{ Initialize DTWAIN } if (DTWAIN_SysInitialize <> 0) then begin FileFlags:= DTWAIN_USENATIVE or DTWAIN_USENAME; FileNames:= 'test.bmp'; { Name of file when image is acquired }
{ Select a Source } SelectedSource := DTWAIN_SelectSource; if SelectedSource <> 0 then begin { Open the source and Acquire to File } AcquiredOk := DTWAIN_AcquireFile( SelectedSource, PChar(FileNames), DTWAIN_BMP, FileFlags, DTWAIN_PT_DEFAULT, 1, TRUE, TRUE, ErrStatus); end; end end end; ___________________________________________________________
That's all there is to it. To use DTWAIN with Delphi, your Delphi project must add the DTWAIN32.PAS that comes with DTWAIN to your project.
|