代码拉取完成,页面将自动刷新
unit frmBusyUnit;
{$mode objfpc}{$H+}
interface
uses
{$ifdef windows}
windows,
{$endif}
{$ifdef darwin}
macport,
{$endif}
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, memscan, syncobjs, betterControls;
type
{ TfrmBusy }
TfrmBusy = class(TForm)
Label1: TLabel;
Timer1: TTimer;
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormShow(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
oktoclose: boolean;
fReason: TPostScanState;
procedure setReason(r: TPostScanState);
public
{ public declarations }
{$IFDEF windows}
WaitForHandle: THandle;
{$ENDIF}
{$ifdef darwin}
WaitForEvent: TEvent;
{$endif}
memscan: TMemScan;
property reason: TPostScanState read fReason write setReason;
end;
resourcestring
rsBusy='The previous scan is still being processed. Please wait';
rsJustFinished = '(Just starting to process)';
rsOptimizingScanResults = '(Optimizing result list for improved speed)';
rsTerminatingThreads = '(Freeing scanner thread memory)';
rsSavingFirstScanResults = '(Copying results for first scan scanner option)';
rsShouldBeFinished = '(There''s no reason to wait)';
rsSavingFirstScanResults2 = '(Still copying the results for the first scan '
+'scanner option)';
implementation
{$R *.lfm}
{ TfrmBusy }
procedure TfrmBusy.setReason(r: TPostScanState);
var reasonstr: string;
begin
if r<>fReason then
begin
freason:=r;
reasonstr:=#13#10;
case r of
psJustFinished: reasonstr:=reasonstr+rsJustFinished;
psOptimizingScanResults: reasonstr:=reasonstr+rsOptimizingScanResults;
psTerminatingThreads: reasonstr:=reasonstr+rsTerminatingThreads;
psSavingFirstScanResults: reasonstr:=reasonstr+rsSavingFirstScanResults;
psShouldBeFinished: reasonstr:=reasonstr+rsShouldBeFinished;
psSavingFirstScanResults2: reasonstr:=reasonstr+rsSavingFirstScanResults2
else
reasonstr:='';
end;
label1.caption:=rsBusy+reasonstr;
end;
end;
procedure TfrmBusy.FormShow(Sender: TObject);
begin
timer1.enabled:=true;
end;
procedure TfrmBusy.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
canclose:=oktoclose;
end;
procedure TfrmBusy.Timer1Timer(Sender: TObject);
var
{$ifdef windows}
r:dword;
{$endif}
{$ifdef darwin}
r: TWaitResult;
{$endif}
begin
{$IFDEF windows} if (WaitForHandle<>0) then {$ENDIF}
{$IFDEF darwin} if (WaitForEvent<>nil) then {$ENDIF}
begin
{$IFDEF darwin}
r:=WaitForEvent.WaitFor(50);
if r<>wrTimeout then
begin
oktoclose:=true;
if fsModal in FFormState then
begin
if r=wrSignaled then
modalresult:=mrok
else
modalresult:=mrcancel;
end
else
close;
end;
{$ENDIF}
{$ifdef windows}
r:=WaitForSingleObject(WaitForHandle, 50);
if r<>WAIT_TIMEOUT then
begin
oktoclose:=true;
if fsModal in FFormState then
begin
if r=WAIT_OBJECT_0 then
modalresult:=mrok
else
modalresult:=mrcancel;
end
else
close;
end;
{$endif}
end;
if (memscan<>nil) and (reason<>memscan.postscanstate) then
begin
reason:=memscan.postScanState;
end;
end;
initialization
end.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。