home *** CD-ROM | disk | FTP | other *** search
/ PC Open 19 / pcopen19.iso / Zipped / CALMIR21.ZIP / SOURCE.ZIP / SRC / REPLACE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-02-20  |  3.0 KB  |  87 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 2.1                                                    }
  5. {    Copyright (C) 1997-1998 Li-Hsin Huang                                 }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit Replace;
  24.  
  25. interface
  26.  
  27. uses
  28.   Classes, SysUtils, Controls, Forms, StdCtrls, Buttons, ExtCtrls;
  29.  
  30. type
  31.   TReplaceBox = class(TForm)
  32.     Label1: TLabel;
  33.     Target1: TLabel;
  34.     Target2: TLabel;
  35.     Label4: TLabel;
  36.     Source1: TLabel;
  37.     Source2: TLabel;
  38.     YesBtn: TBitBtn;
  39.     NoBtn: TBitBtn;
  40.     AllBtn: TBitBtn;
  41.     CancelBtn: TBitBtn;
  42.     Image1: TImage;
  43.     procedure FormCreate(Sender: TObject);
  44.   private
  45.     { Private declarations }
  46.   public
  47.     { Public declarations }
  48.     function Query(const Filename, Destname: TFilename): Integer;
  49.   end;
  50.  
  51. var
  52.   ReplaceBox: TReplaceBox;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57.  
  58. uses Strings, MiscUtil, WinProcs, WinTypes, Desk;
  59.  
  60. procedure AssignDetails(const fname: TFilename; NameLabel, InfoLabel: TLabel);
  61. var
  62.   rec: TSearchRec;
  63. begin
  64.   FindFirst(fname, faAnyfile, rec);
  65.   NameLabel.Caption := fname;
  66.   InfoLabel.Caption := Format('%s  %s', [FormatByte(rec.Size, 2),
  67.     FormatDateTime('dddd d mmmm yyyy,  hh:mm am/pm',
  68.       TimestampToDate(rec.Time))]);
  69. end;
  70.  
  71. function TReplaceBox.Query(const Filename, Destname: TFilename): Integer;
  72. begin
  73.   AssignDetails(Destname, Target1, Target2);
  74.   AssignDetails(Filename, Source1, Source2);
  75.   Desktop.SetCursor(crDefault);
  76.   try Result := ShowModal;
  77.   finally Desktop.ReleaseCursor;
  78.   end;
  79. end;
  80.  
  81. procedure TReplaceBox.FormCreate(Sender: TObject);
  82. begin
  83.   Image1.Picture.Icon.Handle := LoadIcon(0, IDI_QUESTION);
  84. end;
  85.  
  86. end.
  87.