home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: WTOUCH }
-
- { This program works the same way Borland's TOUCH.COM for
- DOS works. Enter a data and a time: 01/01/56 05:00:00AM
- and choose a directory. The program will then iterate
- through that directory and all nested directories under
- it and set the file date to the date and time that
- you specify. }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs,
- Messages, Classes, Graphics,
- Controls, Forms, Dialogs,
- AllDirs, Fileiter, StdCtrls,
- FileCtrl, Mask, Buttons;
-
- const
- HelpStr: PChar =
- 'This program works the same way Borland''s TOUCH.COM for ' +
- 'DOS works. Enter a data and a time: 01/01/56 05:00:00AM ' +
- 'and choose a directory. The program will then iterate ' +
- 'through that directory and all nested directories under ' +
- 'it and set the file date/time.';
-
- type
- TForm1 = class(TForm)
- FileIterator1: TFileIterator;
- Label1: TLabel;
- DirectoryListBox1: TDirectoryListBox;
- DriveComboBox1: TDriveComboBox;
- Label2: TLabel;
- Label3: TLabel;
- MaskEdit1: TMaskEdit;
- MaskEdit2: TMaskEdit;
- BTouch: TBitBtn;
- BHelp: TBitBtn;
- BClose: TBitBtn;
- procedure FileIterator1FoundFile(FileName: String; SR: TSearchRec);
- procedure RunTouchClick(Sender: TObject);
- procedure BHelpClick(Sender: TObject);
- procedure BCloseClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FileIterator1FoundFile(FileName: String; SR: TSearchRec);
- var
- F: file;
- DateTime: TDateTime;
- Age: LongInt;
- begin
- System.Assign(F, FileName);
- Reset(F);
- DateTime := StrToDateTime(MaskEdit1.Text + ' ' + MaskEdit2.Text);
- Age := DateTimeToFileDate(DateTime);
- FileSetDate(TFileRec(F).Handle, Age);
- System.Close(F);
- Label1.Caption := FileName;
- Application.ProcessMessages;
- end;
-
- procedure TForm1.RunTouchClick(Sender: TObject);
- begin
- FileIterator1.Run('*.*', DirectoryListBox1.Directory);
- end;
-
- procedure TForm1.BHelpClick(Sender: TObject);
- begin
- MessageBox(Handle, HelpStr, 'Touch for Windows', mb_Ok or mb_IconInformation);
- end;
-
- procedure TForm1.BCloseClick(Sender: TObject);
- begin
- Close;
- end;
-
- end.
-