Subversion Repositories autosfx

Rev

Blame | Last modification | View Log | RSS feed

  1. unit Main9_1;
  2. (************************************************************************
  3.  Copyright (C) 2009, 2010  by Russell J. Peters, Roger Aelbrecht,
  4.       Eric W. Engler and Chris Vleghert.
  5.  
  6.    This file is part of TZipMaster Version 1.9.
  7.  
  8.     TZipMaster is free software: you can redistribute it and/or modify
  9.     it under the terms of the GNU Lesser General Public License as published by
  10.     the Free Software Foundation, either version 3 of the License, or
  11.     (at your option) any later version.
  12.  
  13.     TZipMaster is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.     GNU Lesser General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU Lesser General Public License
  19.     along with TZipMaster.  If not, see <http://www.gnu.org/licenses/>.
  20.  
  21.     contact: problems@delphizip.org (include ZipMaster in the subject).
  22.     updates: http://www.delphizip.org
  23.     DelphiZip maillist subscribe at http://www.freelists.org/list/delphizip
  24. ************************************************************************)
  25.  
  26.  
  27. interface
  28.  
  29. uses
  30.   Windows, Messages, SysUtils, {Variants,} Classes, Graphics, Controls, Forms,
  31.   Dialogs, StdCtrls, ExtCtrls;
  32.  
  33. type
  34.   TForm1 = class(TForm)
  35.         Memo1: TMemo;
  36.     Panel1: TPanel;
  37.     Button1: TButton;
  38.     Button2: TButton;
  39.     procedure FormCreate(Sender: TObject);
  40.     procedure Button2Click(Sender: TObject);
  41.     procedure Button1Click(Sender: TObject);
  42.   private
  43.         { Private declarations }
  44.         fzip: TThread;
  45.   public
  46.         { Public declarations }
  47.         property ZipThread: TThread read fzip write fzip;
  48.   end;
  49.  
  50. var
  51.   Form1: TForm1;
  52.  
  53. implementation
  54. Uses
  55.         ZThrd;
  56.  
  57. {$R *.dfm}
  58.  
  59.  
  60. procedure TForm1.FormCreate(Sender: TObject);
  61. begin
  62.         fzip := nil;
  63. end;
  64.  
  65. procedure TForm1.Button2Click(Sender: TObject);
  66. begin
  67.         if assigned(fzip) then
  68.                 fzip.Terminate
  69.         else
  70.                 Memo1.Lines.Add('**** Not Running ****');
  71. end;
  72.  
  73. procedure TForm1.Button1Click(Sender: TObject);
  74. var sl: TStringList;
  75. begin
  76.         if not assigned(fzip) then
  77.         begin
  78.                 sl := TStringList.Create;
  79.                 try
  80.                         sl.Add('*.pas');
  81.                         sl.Add('*.dfm');
  82.                         sl.Add('*.bpr');
  83.                         fzip := TZipThread.Create('test.zip',sl,Memo1,false);
  84.                 finally
  85.                         sl.Free;
  86.                 end;
  87.         end;
  88. end;
  89.  
  90. end.
  91.  
  92.