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
UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
Comparez les prix

HTC Magic
Entre 429€ et 429€
|