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

📄 cupdate.pas

📁 根据箱号
💻 PAS
字号:
unit Cupdate;

interface

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

type
  Tupdate1 = class(TForm)
    Panel1: TPanel;
    Gauge_process: TGauge;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
    Procedure CopyFileWithGauge_process(Source,Destination : string);
  public
    { Public declarations }
  end;
Var

Fn : String;

TSI : TStartupInfo;

TPI : TProcessInformation;
var
  update1: Tupdate1;

implementation

{$R *.dfm}
Procedure Tupdate1.CopyFileWithGauge_process(Source,Destination : string);
var
  FromF,ToF : file of byte;
  Buffer : array[0..4096] of char;
  NumRead : integer;
  FileLength : longint;
  begin
    AssignFile(FromF,Source);
    reset(FromF);
    AssignFile(ToF,Destination);
    rewrite(ToF);
    FileLength:=FileSize(FromF);
    With Gauge_process do
      begin
        Gauge_process.MaxValue:=FileLength;
        Gauge_process.Progress:=0;
        while FileLength > 0 do
          begin
            BlockRead(FromF,Buffer[0],SizeOf(Buffer),NumRead);
            FileLength := FileLength - NumRead;
            BlockWrite(ToF,Buffer[0],NumRead);
            Gauge_process.Progress :=Gauge_process.Progress + NumRead;
          end;
          CloseFile(FromF);
          CloseFile(ToF);
     end;
end;

procedure Tupdate1.BitBtn1Click(Sender: TObject);
begin
  try
    label1.Visible:=true;
    application.ProcessMessages;
    CopyFileWithGauge_process((Pchar('\\Ptacliu\手机销售管理系统\IMEI.exe')),Pchar(Trim(ExtractFilePath(Application.ExeName))+ExtractFileName(Trim('\\ptacliu\销售手机管理系统\IMEI.exe'))));
    application.MessageBox('程序升级成功!','提示',64);
    close;
  except
    application.MessageBox('程序升级失败,请重新升级!','提示',64);
  end;
end;
procedure Tupdate1.BitBtn2Click(Sender: TObject);
begin
  close;
end;

end.

⌨️ 快捷键说明

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