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

📄 p_cxthread.pas

📁 这个是我自己写的
💻 PAS
字号:
unit p_cxThread;

interface

uses
  Windows, Messages, Classes,Forms,DB,p_Client,SysUtils;

type
  cxThread = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;

implementation

{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure cxThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ cxThread }

Function cxUpdate:Boolean;
var
  cxFile:TMemoryStream;
  FilePath:String;
begin
  Result := False;
  with frm_Client.sp_se_cxVersion do
  begin
    Close;
    Parameters.ParamByName('@cxNO').Value := 2;
    Open;
  end;
  if frm_Client.sp_se_cxVersion.RecordCount = 0 then
  begin
    Application.MessageBox('没有找到更新文件,请手动更新!','提示',0+16);
    Application.Terminate;
    Result := False;
    Exit;
  end;
  FilePath:=ExtractFilePath(ParamStr(0));
  if FileExists(FilePath+'Temp.exe') then
  begin
    DeleteFile(FilePath+'Temp.exe');
  end;
  FilePath:=FilePath+'Temp.exe';
  cxFile := TMemoryStream.Create;
  cxFile.Clear;
  try
    TBlobField(frm_Client.sp_se_cxVersion.FieldByName('cxStream')).SaveToStream(cxFile);
    cxFile.SaveToFile(FilePath);
  Except
    cxFile.Free;
    Result := False;
    Exit;
  end;
  cxFile.Free;
  Result := True;
end;

procedure cxThread.Execute;
begin
  { Place thread code here }
  if not cxUpdate then
  begin
    Application.MessageBox('更新程序失败!请手动更新','提示',0+16);
    bz:=2;
    Exit;
  end;
  bz:= 1;
end;

end.

⌨️ 快捷键说明

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