?? p_cxthread.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 + -