Accueil > > > LANCE UN PING ET LE RECUPERE DANS UNE FENETRE STYLE FLASHGET
LANCE UN PING ET LE RECUPERE DANS UNE FENETRE STYLE FLASHGET
Information sur la source
Description
hello je suis en 56k alors je ping souvent un server pour voir si je lag ou pas :) c'est un laggometre lol voila c tout
Source
- unit Main;
-
- interface
-
- uses
- Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
- SysUtils, Classes, IdIcmpClient, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
- Gauges, ImgList, Buttons, XPMan, SkinCtrls, Menus, ComCtrls;
-
-
- type
- TfrmPing = class(TForm)
- ICMP: TIdIcmpClient;
- TimerPing: TTimer;
- XPManifest1: TXPManifest;
- edtHost: TEdit;
- GaugePing: TGauge;
- btnPing: TSpeedButton;
- LabelPing: TLabel;
- spSkinLinkLabel1: TspSkinLinkLabel;
- PopupMenu1: TPopupMenu;
- mnModePlein: TMenuItem;
- mnModeReduit: TMenuItem;
- mnPing: TMenuItem;
- mnQuitter: TMenuItem;
- TrackBarAlpha: TTrackBar;
- procedure ICMPReply(ASender: TComponent; const ReplyStatus: TReplyStatus);
- procedure btnPingClick(Sender: TObject);
- procedure TimerPingTimer(Sender: TObject);
- procedure btStopClick(Sender: TObject);
- procedure spSkinLinkLabel1DblClick(Sender: TObject);
- procedure mnModeReduitClick(Sender: TObject);
- procedure mnModePleinClick(Sender: TObject);
- procedure mnQuitterClick(Sender: TObject);
- procedure mnPingClick(Sender: TObject);
- procedure TrackBarAlphaChange(Sender: TObject);
- private
- public
- end;
-
- var
- frmPing: TfrmPing;
-
- implementation
- {$R *.DFM}
- uses Shellapi;
-
- procedure TfrmPing.ICMPReply(ASender: TComponent; const ReplyStatus: TReplyStatus);
- var
- sHint, sTime: string;
- sGauge: integer;
- begin
- // TODO: check for error on ping reply (ReplyStatus.MsgType?)
- sTime := '';
- sHint := Format('%s%d ms',[sTime,ReplyStatus.MsRoundTripTime]);
- sGauge := strtoint(Format('%s%d',[sTime,ReplyStatus.MsRoundTripTime]));
- LabelPing.caption := inttostr(sGauge)+'ms';
-
- if sGauge<1000 then
- begin
- GaugePing.MaxValue := 1000;
- GaugePing.ForeColor := clLime;
- end;
-
- if sGauge>=1000 then
- begin
- GaugePing.MaxValue := 2000;
- end;
-
- if sGauge>=2000 then
- begin
- GaugePing.MaxValue := 3000;
- GaugePing.ForeColor := $00009CFF;
- end;
-
- if sGauge>=3000 then
- begin
- GaugePing.MaxValue := 4000;
- end;
-
- if sGauge>=4000 then
- begin
- GaugePing.MaxValue := 5000;
- GaugePing.ForeColor := clRed;
- end;
-
- GaugePing.Hint := sHint;
- GaugePing.Progress := sGauge;
-
- end;
-
- procedure TfrmPing.btnPingClick(Sender: TObject);
- begin
- if btnPing.caption = 'ping'
- then
- begin
- TimerPing.Enabled := true;
- btnPing.caption := 'stop';
- mnPing.Caption := 'Stop Ping'
- end
- else
- begin
- TimerPing.Enabled := false;
- edtHost.enabled := true;
- btnPing.caption := 'ping';
- mnPing.Caption := 'Start Ping'
- end;
- end;
-
- procedure TfrmPing.TimerPingTimer(Sender: TObject);
- var
- i: integer;
- begin
- ICMP.OnReply := ICMPReply;
- ICMP.ReceiveTimeout := 1000;
- edtHost.Enabled := false; try
- ICMP.Host := edtHost.Text;
- ICMP.Ping;
- Application.ProcessMessages;
- finally end;
- end;
-
- procedure TfrmPing.btStopClick(Sender: TObject);
- begin
- TimerPing.Enabled := false;
- edtHost.enabled := true;
- end;
-
- procedure TfrmPing.spSkinLinkLabel1DblClick(Sender: TObject);
- begin
- ShellExecute(Handle,'OPEN','mailto:diabloporc@laposte.net',Nil,Nil,SW_SHOW);
- end;
-
- procedure TfrmPing.mnModeReduitClick(Sender: TObject);
- begin
- frmPing.BorderStyle := bsNone;
- frmPing.ClientWidth := 50;
- frmPing.ClientHeight := 50;
- end;
-
- procedure TfrmPing.mnModePleinClick(Sender: TObject);
- begin
- frmPing.BorderStyle := bsDialog;
- frmPing.ClientWidth := 155;
- frmPing.ClientHeight := 50;
- end;
-
- procedure TfrmPing.mnQuitterClick(Sender: TObject);
- begin
- TimerPing.enabled := false;
- application.terminate;
- end;
-
- procedure TfrmPing.mnPingClick(Sender: TObject);
- begin
- btnPing.Click;
- end;
-
- procedure TfrmPing.TrackBarAlphaChange(Sender: TObject);
- begin
- frmPing.AlphaBlendValue := TrackBarALpha.Position;
- end;
-
- end.
unit Main;
interface
uses
Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
SysUtils, Classes, IdIcmpClient, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
Gauges, ImgList, Buttons, XPMan, SkinCtrls, Menus, ComCtrls;
type
TfrmPing = class(TForm)
ICMP: TIdIcmpClient;
TimerPing: TTimer;
XPManifest1: TXPManifest;
edtHost: TEdit;
GaugePing: TGauge;
btnPing: TSpeedButton;
LabelPing: TLabel;
spSkinLinkLabel1: TspSkinLinkLabel;
PopupMenu1: TPopupMenu;
mnModePlein: TMenuItem;
mnModeReduit: TMenuItem;
mnPing: TMenuItem;
mnQuitter: TMenuItem;
TrackBarAlpha: TTrackBar;
procedure ICMPReply(ASender: TComponent; const ReplyStatus: TReplyStatus);
procedure btnPingClick(Sender: TObject);
procedure TimerPingTimer(Sender: TObject);
procedure btStopClick(Sender: TObject);
procedure spSkinLinkLabel1DblClick(Sender: TObject);
procedure mnModeReduitClick(Sender: TObject);
procedure mnModePleinClick(Sender: TObject);
procedure mnQuitterClick(Sender: TObject);
procedure mnPingClick(Sender: TObject);
procedure TrackBarAlphaChange(Sender: TObject);
private
public
end;
var
frmPing: TfrmPing;
implementation
{$R *.DFM}
uses Shellapi;
procedure TfrmPing.ICMPReply(ASender: TComponent; const ReplyStatus: TReplyStatus);
var
sHint, sTime: string;
sGauge: integer;
begin
// TODO: check for error on ping reply (ReplyStatus.MsgType?)
sTime := '';
sHint := Format('%s%d ms',[sTime,ReplyStatus.MsRoundTripTime]);
sGauge := strtoint(Format('%s%d',[sTime,ReplyStatus.MsRoundTripTime]));
LabelPing.caption := inttostr(sGauge)+'ms';
if sGauge<1000 then
begin
GaugePing.MaxValue := 1000;
GaugePing.ForeColor := clLime;
end;
if sGauge>=1000 then
begin
GaugePing.MaxValue := 2000;
end;
if sGauge>=2000 then
begin
GaugePing.MaxValue := 3000;
GaugePing.ForeColor := $00009CFF;
end;
if sGauge>=3000 then
begin
GaugePing.MaxValue := 4000;
end;
if sGauge>=4000 then
begin
GaugePing.MaxValue := 5000;
GaugePing.ForeColor := clRed;
end;
GaugePing.Hint := sHint;
GaugePing.Progress := sGauge;
end;
procedure TfrmPing.btnPingClick(Sender: TObject);
begin
if btnPing.caption = 'ping'
then
begin
TimerPing.Enabled := true;
btnPing.caption := 'stop';
mnPing.Caption := 'Stop Ping'
end
else
begin
TimerPing.Enabled := false;
edtHost.enabled := true;
btnPing.caption := 'ping';
mnPing.Caption := 'Start Ping'
end;
end;
procedure TfrmPing.TimerPingTimer(Sender: TObject);
var
i: integer;
begin
ICMP.OnReply := ICMPReply;
ICMP.ReceiveTimeout := 1000;
edtHost.Enabled := false; try
ICMP.Host := edtHost.Text;
ICMP.Ping;
Application.ProcessMessages;
finally end;
end;
procedure TfrmPing.btStopClick(Sender: TObject);
begin
TimerPing.Enabled := false;
edtHost.enabled := true;
end;
procedure TfrmPing.spSkinLinkLabel1DblClick(Sender: TObject);
begin
ShellExecute(Handle,'OPEN','mailto:diabloporc@laposte.net',Nil,Nil,SW_SHOW);
end;
procedure TfrmPing.mnModeReduitClick(Sender: TObject);
begin
frmPing.BorderStyle := bsNone;
frmPing.ClientWidth := 50;
frmPing.ClientHeight := 50;
end;
procedure TfrmPing.mnModePleinClick(Sender: TObject);
begin
frmPing.BorderStyle := bsDialog;
frmPing.ClientWidth := 155;
frmPing.ClientHeight := 50;
end;
procedure TfrmPing.mnQuitterClick(Sender: TObject);
begin
TimerPing.enabled := false;
application.terminate;
end;
procedure TfrmPing.mnPingClick(Sender: TObject);
begin
btnPing.Click;
end;
procedure TfrmPing.TrackBarAlphaChange(Sender: TObject);
begin
frmPing.AlphaBlendValue := TrackBarALpha.Position;
end;
end.
Conclusion
si vous avez fait une modif, mailez les moi merci :) idem pour les bugs
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko [FRAMEWORK 4] LES TASKS ET LE THREAD UI[FRAMEWORK 4] LES TASKS ET LE THREAD UI par fathi
Je viens de passer quelques temps au TechDay's et j'ai pu voir pas mal de session intéressante. Par contre une chose m'a un peu étonné lors de certaines de ces sessions qui abordaient les améliorations du framework .NET (donc le 4.5) : en gros, bea...
Cliquez pour lire la suite de l'article par fathi WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson TECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PCTECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PC par ROMELARD Fabrice
Speakers: Thierry Rapatout, Antoine Petit et Xavier Trebbia Cette session entre dans le cadre des RDV Décideurs des TechDays 2012, elle est liée à la consumérisation de l'IT et la mise en place du "DeskTop as a Service" dans de plus en ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLETECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLE par ROMELARD Fabrice
Speakers: Julien Marechal, Gautier Confiant, Sébastien MEYER La session débute par le positionnement de la solution System Center par rapport aux concepts d'organisation ITIL. Le portail du catalogue de se...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|