Unit16.pas
上传用户:szyozho
上传日期:2013-04-13
资源大小:3688k
文件大小:1k
源码类别:

教育系统应用

开发平台:

Delphi

  1. unit Unit16;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Buttons, ExtCtrls;
  6. type
  7.   Trestoreform = class(TForm)
  8.     Image1: TImage;
  9.     Label1: TLabel;
  10.     Label2: TLabel;
  11.     Label3: TLabel;
  12.     Label4: TLabel;
  13.     Edit1: TEdit;
  14.     SpeedButton1: TSpeedButton;
  15.     OpenDialog1: TOpenDialog;
  16.     BitBtn1: TBitBtn;
  17.     BitBtn2: TBitBtn;
  18.     Label5: TLabel;
  19.     Label6: TLabel;
  20.     Label7: TLabel;
  21.     Label8: TLabel;
  22.     procedure SpeedButton1Click(Sender: TObject);
  23.     procedure BitBtn1Click(Sender: TObject);
  24.   private
  25.     { Private declarations }
  26.   public
  27.     { Public declarations }
  28.   end;
  29. var
  30.   restoreform: Trestoreform;
  31. implementation
  32. {$R *.dfm}
  33. procedure Trestoreform.SpeedButton1Click(Sender: TObject);
  34. begin
  35. if self.OpenDialog1.Execute then
  36. edit1.Text:=self.OpenDialog1.FileName;
  37. end;
  38. procedure Trestoreform.BitBtn1Click(Sender: TObject);
  39. var
  40. i:string;
  41. failure:boolean;
  42. begin
  43. failure:=false;
  44. i:=ExtractFilePath(Application.ExeName);
  45. if fileexists(pchar(i+'abao')) then
  46. begin
  47. deletefile(pchar(i+'abao'));
  48. if not copyfile(pchar(trim(edit1.Text)),pchar(i+'abao'),false) then
  49. failure:=true;
  50. end;
  51. if failure then
  52. ShowMessage('数据恢复没有成功!')
  53. else
  54. showmessage('数据恢复成功!');
  55. end;
  56. end.