⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 restore_unit.~pa

📁 网上搜索来的进销存源码
💻 ~PA
字号:
unit Restore_Unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls, ShellAPI;

type
  TRestore_Form = class(TForm)
    Label1: TLabel;
    GroupBox1: TGroupBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label2: TLabel;
    Path_Edit: TEdit;
    SpeedButton1: TSpeedButton;
    Label3: TLabel;
    OpenDialog1: TOpenDialog;
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    function RestoreFile: Boolean;
  public
    { Public declarations }
  end;

var
  Restore_Form: TRestore_Form;

implementation

{$R *.dfm}

function TRestore_Form.RestoreFile: Boolean;
var
  ExePath: string;
begin
  ExePath := ExtractFilePath(Application.ExeName);
  if Path_Edit.Text = '' then
  begin
    Application.MessageBox('选择恢复路径及文件名!', '提示', Mb_ok or Mb_IconWarning);
    Exit;
  end;
  if UpperCase(ExtractFileExt(Path_Edit.Text)) <> '.LXP' then
  begin
    Application.MessageBox('请选择正确的备份文件!', '提示', Mb_ok or Mb_IconWarning);
    Exit;
  end;
  if Application.MessageBox('恢复数据将导致现在的数据文件被覆盖,你确认吗?', '提示', Mb_YesNo or Mb_IconQuestion) = IdYes then
  begin
    try
      CopyFile(Pchar(Path_Edit.Text), Pchar(ExePath + 'mdb\' + 'jxc.mdb'), False);
      Result := True;
      Application.MessageBox('恢复成功,请重新启动本软件!', '提示', Mb_ok or Mb_Iconinformation);
      Application.Terminate;
    except
      Result := False;
      Application.MessageBox('恢复失败!', '提示', Mb_ok or Mb_Iconerror);
    end;
  end;
end;

procedure TRestore_Form.SpeedButton1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    Path_Edit.Text := OpenDialog1.FileName;
  end;
end;

procedure TRestore_Form.BitBtn1Click(Sender: TObject);
begin
  RestoreFile;
end;

procedure TRestore_Form.FormShow(Sender: TObject);
begin
  Path_Edit.Clear;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -