📄 threak.~pas
字号:
unit threak;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TBackupthead = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
public
Procedure BackupDatabase;
end;
implementation
uses sjbf,datamodal;
{ 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 TBackupthead.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TBackupthead }
procedure TBackupthead.BackupDatabase;
begin
if Trim(f_sjbf.lj.Text)<>'' then
begin
Try
with Data.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('Backup DataBase qygl to disk = :a');
ParamByName('a').Value := Trim(f_sjbf.lj.Text);
ExecSQL;
end;
Application.MessageBox('备份成功.','提示',64);
f_sjbf.ProBar1.Position := 0;
Thread1.Terminate;
Except
Application.MessageBox('系统出错.','提示',64);
f_sjbf.Close;
end;
end;
end;
procedure TBackupthead.Execute;
begin
while f_sjbf.ProBar1.Position < f_sjbf.ProBar1.Width do
f_sjbf.ProBar1.Position := f_sjbf.ProBar1.Position+2;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -