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

📄 timer.pas

📁 Source code Delphi FTP-server
💻 PAS
字号:
{$A+,B-,C+,D+,E-,F-,G+,H-,I-,J+,K-,L+,M-,N+,O-,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
unit Timer;

{-----------------------------------------------------------------}
{ Timer. To create calibrated timeouts (1/10 sec).                }
{ 11/19/1999 Drt.                                                 }
{-----------------------------------------------------------------}

interface

uses
  Windows, Classes;

type
 pbool = ^boolean;

 TTimeout = class(TThread)
 public
   Flag : pbool;
   Timeout : longint;
   constructor create(ATimeout : longint; AFlag : pbool);
 private
   procedure execute; override;
   end;

implementation

constructor TTimeout.create(ATimeout : longint; AFlag : pbool);
begin
inherited create(true);
FreeOnTerminate:=true;
Flag:=AFlag;
Timeout:=ATimeout;
Flag^:=false;
resume;
end;

procedure TTimeout.execute;
begin
while ((Timeout > 0) or (Timeout < 0)) and not terminated do
  begin
  sleep(100);
  if Timeout > 0 then dec(Timeout);
  end;
Flag^:=true;
if not terminated then terminate;
end;

end.

⌨️ 快捷键说明

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