home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / ISIS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-06-17  |  2.6 KB  |  105 lines

  1. unit ISIS;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, OleCtrls, LTISIOCX, LEADISIS;
  8.  
  9. type
  10.   TISISDlg = class(TForm)
  11.     Button1: TButton;
  12.     Label1: TLabel;
  13.     Label2: TLabel;
  14.     PageNo: TEdit;
  15.     OutFileName: TEdit;
  16.     Button2: TButton;
  17.     LTIsis: TLeadIsisCtrl;
  18.     procedure Button2Click(Sender: TObject);
  19.     procedure Button1Click(Sender: TObject);
  20.     procedure FormShow(Sender: TObject);
  21.     procedure LTIsisISISPage(Sender: TObject; nPage: Integer;
  22.       const pszFileName: string);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28.  
  29. var
  30.   ISISDlg: TISISDlg;
  31.   bCancel:boolean;
  32.   bScanning:boolean;
  33.  
  34. implementation
  35.  
  36. uses Main;
  37.  
  38. {$R *.DFM}
  39.  
  40. procedure TISISDlg.Button2Click(Sender: TObject);
  41. var
  42.    MaxPages:integer;
  43.    bVal : boolean;
  44.    nret : smallint;
  45. begin
  46.    if(bScanning=False) then
  47.    begin
  48.       bVal := True;
  49.       bScanning := True;
  50.       LTIsis.EnableMethodErrors := false;
  51.       {enable ISISPage Event}
  52.       LTIsis.EnableISISEvent := true;
  53.       {Load ISIS Driver}
  54.       nret := LTIsis.ISISLoadDriver();
  55.       if (nret = 0) then
  56.       begin
  57.          {enable ScanAhead, and set max pages to max ADF pages}
  58.          LTIsis.ISISSetTag(TAG_SCANAHEAD, TAG_SCANAHEAD_YES);
  59.          LTIsis.ISISGetTag(TAG_MAXPAGES, MaxPages);
  60.          LTIsis.ISISSetTag(TAG_SCANAHEAD_MAXPAGES, MaxPages);
  61.          LTIsis.ISISAcquireMulti(handle, MainForm.SaveDialog.Filename, ISIS_SHOWUI, MainForm.SaveDialog.SaveFormat, MainForm.SaveDialog.SaveMulti);
  62.          {Unload ISIS Driver}
  63.          LTIsis.ISISUnloadDriver();
  64.       end
  65.       else
  66.          bVal:=False;
  67.       bScanning := False;
  68.       if(bVal = True) then
  69.          ModalResult:=mrOK
  70.       else
  71.       begin
  72.          MessageDlg(IntToStr(LTIsis.PagesDiscarded) + ' pages aborted!', mtInformation, [mbOK], 0);
  73.          ModalResult:=mrAbort;
  74.       end;
  75.    end;
  76. end;
  77.  
  78. procedure TISISDlg.Button1Click(Sender: TObject);
  79. begin
  80.      if(bScanning = True) then
  81.           bCancel:=True
  82.      else
  83.           ModalResult:=mrCancel;
  84. end;
  85.  
  86. procedure TISISDlg.FormShow(Sender: TObject);
  87. begin
  88.      bCancel:=False;
  89.      bScanning:=False;
  90. end;
  91.  
  92. procedure TISISDlg.LTIsisISISPage(Sender: TObject; nPage: Integer;
  93.   const pszFileName: string);
  94. begin
  95.      if(bCancel = True) then
  96.         LTIsis.EnableISISEvent:=false; {cancel scanning}
  97.      PageNo.Text := IntToStr(nPage);
  98.      PageNo.Refresh;
  99.      OutFileName.Text := pszFileName;
  100.      OutFileName.Refresh;
  101.      Application.ProcessMessages;
  102. end;
  103.  
  104. end.
  105.