begin process at 2010 02 10 06:34:25
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Réseau & Internet

 > 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

Note :
8 / 10 - par 1 personne
8,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Réseau & Internet Niveau :Débutant Date de création :21/10/2003 Date de mise à jour :21/10/2003 03:28:27 Vu / téléchargé :5 860 / 816

Auteur : JulioDelphi

Ecrire un message privé
Site perso
Ce membre participe au partage de revenus publicitaires
Commentaire sur cette source (6)
Ajouter un commentaire et/ou une note


 Description

Cliquez pour voir la capture en taille normale
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

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip Source avec une capture SCREENCAMTURE 0.2
Source avec Zip Source avec une capture JOUEZ : LIGHTS 1.4
Source avec Zip Source avec une capture FICLOCK : LOCKEZ LES FICHIERS
Source avec Zip Source avec une capture COMPOSANT TDBPTRACKBARVOLUME - JOUEZ AVEC LE SON !
Source avec Zip Source avec une capture COMPOSANT : TDBPLINKMAKER CREEZ DES .LNK

 Sources de la même categorie

Source avec Zip BASE64/BASE64URL ENCODE/DECODE par f0xi
Source avec Zip AFFICHAGE DES INFODFS par fbalien
Source avec Zip Source avec une capture INTRA MESSENGER - DELPHI par keket
Source avec Zip CODAGE DÉCODAGE PDU 7BITS par AccessToYou
Source avec Zip Source avec une capture SIMPLEWEBBROWSER par cantador

Commentaires et avis

Commentaire de weldoo le 03/05/2004 00:01:13

tu la pris ou ton composant ? car moi il me manque un composant pour pour utiliser ton zip !!!! merci d'avance ;-)

Commentaire de xtrack le 04/07/2004 09:55:51

oui surtout que SkinCtrls nous on l'a pas

Commentaire de JulioDelphi le 07/07/2004 16:15:00 administrateur CS

salut,

http://diabloporc.free.fr/delphi

a+

Commentaire de hurrycane le 20/10/2005 21:43:38

t'est encore au 56 k

Commentaire de facilus le 01/12/2006 19:50:22

cmt savoir si un sereveur repond ou pa de ton code ?

Commentaire de JulioDelphi le 01/12/2006 20:08:49 administrateur CS

@hurrycane : au 21/10/2003 (date de la source) : oui, la campagne n'est pas encore totalement désservie.
@facilus : comment ? si le ping est > 2000, tu peux le considérer mort je pense ^^

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix


HTC Magic

Entre 429€ et 429€

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,718 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales