📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdTimeServer,
StdCtrls;
type
TForm1 = class(TForm)
IdTimeServer1: TIdTimeServer;
Label1: TLabel;
lblStatus: TLabel;
procedure FormActivate(Sender: TObject);
procedure IdTimeServer1Connect(AThread: TIdPeerThread);
procedure IdTimeServer1Disconnect(AThread: TIdPeerThread);
private
{ Private declarations }
lTotalHits : longint;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
procedure TForm1.FormActivate(Sender: TObject);
begin try IdTimeServer1.Active := True; except ShowMessage('Permission Denied. Cannot bind reserved port due to security reasons'); Application.Terminate; end; lTotalHits := 0;end;
procedure TForm1.IdTimeServer1Connect(AThread: TIdPeerThread);
begin
inc(lTotalHits);
// lbHits.Caption := IntToStr(lTotalHits);
lblStatus.caption := '[ '+IntToStr(lTotalHits)+' ]';
end;
procedure TForm1.IdTimeServer1Disconnect(AThread: TIdPeerThread);
begin
// lblStatus.caption := '[ idle ]';
end;
{$R *.dfm}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -