看李微的那三本書!
在主form寫如下過程
procedure TMainForm.UpdateClientCount(Incr: Integer);
begin
FClientCount:= FClientCount + Incr;
ClientCount.Caption := IntToStr(FClientCount);
end;
procedure TMainForm.UpdateQueryCount(Incr:Integer);
begin
FQueryCount :=FQueryCount + Incr;
QueryCount.Caption := IntToStr(FQueryCount);
IF Incr>0 Then
FTotalCount:=FTotalCount+ Incr;
TotalCount.Caption:= IntToStr(FTotalCount);
end;
在你的AppServer寫如下過程:
procedure TPre_AppServer.PConnectAfterConnect(Sender: TObject);
begin
mainform.UpdateClientCount(1);
end;
procedure TPre_AppServer.PConnectAfterDisconnect(Sender: TObject);
begin
mainform.UpdateClientCount(-1);
end;