::: µ¨ÆÄÀÌ Tip&Trick :::

µ¨ÆÄÀÌ Tip&Trick ¼º°Ý¿¡ ¸ÂÁö ¾Ê´Â ±¤°í,ºñ¹æ,Áú¹®ÀÇ ±ÛÀº Áï½Ã »èÁ¦Çϸç
³»¿ëÀ» º¹»çÇÏ¿© »ç¿ëÇÒ °æ¿ì ¹Ýµå½Ã ÀÌ°÷(http://www.howto.pe.kr)À» Ãâó·Î ¸í½ÃÇÏ¿© ÁÖ¼¼¿ä


Category

  ±è¿µ´ë(2004-08-09 20:03:48, Hit : 7586, Vote : 1380
 http://www.howto.pe.kr
 Ping ¼Ò½º

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Winsock;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  IPINFO = record
    Ttl     : char;
    Tos     : char;
    IPFlags : char;
    OptSize : char;
    Options : ^char;
  end;

  ICMPECHO = record
    Source   : longint;
    Status   : longint;
    RTTime   : longint;
    DataSize : Shortint;
    Reserved : Shortint;
    pData    : ^variant;
    i_ipinfo : IPINFO;
  end;

  TIcmpCreateFile =
    function():integer;{$IFDEF WIN32} stdcall; {$ENDIF}
  TIcmpCloseHandle =
    procedure(var handle:integer);{$IFDEF WIN32} stdcall;{$ENDIF}
  TIcmpSendEcho =
    function(var handle:integer; endereco:DWORD; buffer:variant;
    tam:WORD; IP:IPINFO; ICMP:ICMPECHO; tamicmp:DWORD;
    tempo:DWORD):DWORD;{$IFDEF WIN32} stdcall; {$ENDIF}
  
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  wsadt : wsadata;
  icmp :icmpecho;
  HNDicmp : integer;
  hndFile :integer;
  Host :PHostEnt;
  Destino :in_addr;
  Endereco :^DWORD;
  IP : ipinfo;
  Retorno :integer;
  dwRetorno :DWORD;
  x :integer;

  IcmpCreateFile : TIcmpCreateFile;
  IcmpCloseHandle : TIcmpCloseHandle;
  IcmpSendEcho : TIcmpSendEcho;

begin
  if (edit1.Text = '') then
  begin
    Application.MessageBox('È£½ºÆ® À̸§À̳ª IP¸¦ ÀÔ·ÂÇϼ¼¿ä','Error', MB_OK);
    exit;
  end;
  HNDicmp := LoadLibrary('ICMP.DLL');
  if (HNDicmp <> 0) then
  begin
    @IcmpCreateFile := GetProcAddress(HNDicmp,'IcmpCreateFile');
    @IcmpCloseHandle := GetProcAddress(HNDicmp,'IcmpCloseHandle');
    @IcmpSendEcho := GetProcAddress(HNDicmp,'IcmpSendEcho');
    if (@IcmpCreateFile=nil) or (@IcmpCloseHandle=nil) or
       (@IcmpSendEcho=nil) then
    begin
      Application.MessageBox('Error getting ICMP Adress','Error', MB_OK);
      FreeLibrary(HNDicmp);
    end;
  end;
  Retorno := WSAStartup($0101,wsadt);

  if (Retorno <> 0) then
  begin
    Application.MessageBox('WinSocket À» ·ÎµåÇÏÁö ¸øÇÕ´Ï´Ù','WSAStartup', MB_OK);
    WSACleanup();
    FreeLibrary(HNDicmp);
  end;

  Destino.S_addr := inet_addr(Pchar(Edit1.text));
  if (Destino.S_addr = 0) then
  begin
    Host := GetHostbyName(PChar(Edit1.text));
  end
  else
  begin
    Host := GetHostbyAddr(@Destino,sizeof(in_addr), AF_INET);
  end;

  if (host = nil) then
  begin
    Application.MessageBox('Host not found','Error', MB_OK);
    WSACleanup();
    FreeLibrary(HNDicmp);
    exit;
  end;
  memo1.Lines.Add('Pinging ' + Edit1.text);

  Endereco := @Host.h_addr_list;

  HNDFile := IcmpCreateFile();
  for x:= 0 to 4 do
  begin
    Ip.Ttl := char(255);
    Ip.Tos := char(0);
    Ip.IPFlags := char(0);
    Ip.OptSize := char(0);
    Ip.Options := nil;

    dwRetorno := IcmpSendEcho(
                    HNDFile,
                    Endereco^,
                    null,
                    0,
                    Ip,
                    Icmp,
                    sizeof(Icmp),
                    DWORD(5000));

    Destino.S_addr := icmp.source;
    Memo1.Lines.Add('Ping ' + Edit1.text);
  end;


  IcmpCLoseHandle(HNDFile);
  FreeLibrary(HNDicmp);
  WSACleanup();
end;

end.





171   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Ç¥ÁØ TListBox ¿¡ Radio ¹öÆ° ¿Ã¸®±â  ±è¿µ´ë 2004/07/27 4658 1256
170   [½Ã½ºÅÛ] ½ÇÇàÁßÀÎ ¸ðµç ÇÁ·Î¼¼½ºÀÇ Domain, User ±¸ÇÏ±â  ±è¿µ´ë 2004/07/27 5958 1379
169   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] RichEdit ÀÇ ¸¶¿ì½º Ä¿¼­ ¾Æ·¡ÀÇ ±ÛÀÚ ±¸ÇÏ±â  ±è¿µ´ë 2004/07/27 5221 1216
168   [½Ã½ºÅÛ] Keyboard hook À» »ç¿ëÇÑ OnKeyDown ±¸Çö  ±è¿µ´ë 2004/07/27 5850 1459
167   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TListBox ÀÇ ¸¶¿ì½º Ä¿¼­ ¾Æ·¡ÀÇ ¾ÆÀÌÅÛ ±¸ÇÏ±â  ±è¿µ´ë 2004/07/27 4342 1172
166   [COM/OLE] ƯÁ¤ À¥ÆäÀÌÁöÀÇ ¸ðµç Link URL ±¸ÇÏ±â  ±è¿µ´ë 2004/07/27 6235 1649
165   [COM/OLE] PDF ActiveX »ç¿ëÇÏ±â  ±è¿µ´ë 2004/08/02 5775 1338
164   [COM/OLE] ƯÁ¤ »çÀÌÆ®ÀÇ ³»¿ëÀ» JPG ·Î ÀúÀåÇÏ±â  ±è¿µ´ë 2004/08/02 5814 1328
163   [COM/OLE] ƯÁ¤ »çÀÌÆ®ÀÇ form À» °­Á¦ submit ÇÏ±â  ±è¿µ´ë 2004/08/02 6562 1610
162   [COM/OLE] IE ¿¡ Á÷Á¢ ÀÔ·ÂÇÑ URL ¸ñ·Ï ±¸ÇÏ±â  ±è¿µ´ë 2004/08/02 4945 1216
161   [½Ã½ºÅÛ] ¿ÜºÎ ÇÁ·Î±×·¥ Á¾·á ½ÃÅ°±â  ±è¿µ´ë 2004/08/02 10335 1351
160   [½Ã½ºÅÛ] DOS (¸í·É ÇÁ·ÒÇÁÆ®) âÀÇ »ö»ó, È­¸é ¸ðµå ¹Ù²Ù±â  ±è¿µ´ë 2004/08/02 6211 1790
159   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Search and Select  ±è¿µ´ë 2004/08/03 6339 1722
158   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Zlib ¸¦ ÀÌ¿ëÇÑ ¾ÐÃà°ú ÇØÁ¦  ±è¿µ´ë 2004/08/03 5904 1353
157   [½Ã½ºÅÛ] ÀÏÁ¤½Ã°£ °æ°ú ÈÄ À©µµ¿ìÁî Á¾·áÇÏ±â  ±è¿µ´ë 2004/08/03 5243 1254
156   [½Ã½ºÅÛ] DOS ¸í·É¾î ½ÇÇàÇÏ°í °á°ú ¹Þ¾Æ¿À±â (Win2k,XP)  ±è¿µ´ë 2004/08/03 6345 1527
155   [½Ã½ºÅÛ] À©µµ¿ìÁî È­¸é Àá±×±â  ±è¿µ´ë 2004/08/03 5744 1452
154   [½Ã½ºÅÛ] À©µµ¿ìÁî »ç¿ëÀÚ °èÁ¤ Á¤º¸ ±¸ÇÏ±â  ±è¿µ´ë 2004/08/03 5906 1559
153   [½Ã½ºÅÛ] ÆÄÀÏÀÇ ¼ÒÀ¯ÀÚ¿Í µµ¸ÞÀÎ ±¸ÇÏ±â  ±è¿µ´ë 2004/08/04 4841 1319
152   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Hex Viewer  ±è¿µ´ë 2004/08/04 4782 1168
151   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] RichEdit ¿¡ URL link ¸¸µé±â  ±è¿µ´ë 2004/08/04 6648 1583
150   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] µ¿ÀûÀ¸·Î »ý¼ºÇÑ TLabel ¸¶¿ì½º·Î À̵¿½ÃÅ°±â  ±è¿µ´ë 2004/08/04 7022 2044
149   [À©µµ¿ìÁî API] ¼¼·Î ŸÀÌƲ¹Ù ¸¸µé±â  ±è¿µ´ë 2004/08/04 5765 1522
148   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TPanel ·Î ¸¸µç ÈùÆ®  ±è¿µ´ë 2004/08/05 5002 1279
147   [½Ã½ºÅÛ] À©µµ¿ìÁî ºÎÆà ¸ðµå(Á¤»ó, ¾ÈÀü)  ±è¿µ´ë 2004/08/05 4751 1329
146   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ListView ³»¿ëÀ» ÆÄÀÏ·Î ÀúÀåÇÏ°í ºÒ·¯¿À±â  ±è¿µ´ë 2004/08/05 5182 1222
145   [À©µµ¿ìÁî API] ÈÞÁöÅëÀÌ ºñ¾îÀÖ´ÂÁö È®ÀÎÇÏ±â  ±è¿µ´ë 2004/08/05 5736 1372
144   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TreeView ÀÇ ³ëµå¸¦ º¼µå(Bold)·Î °­Á¶ÇÏ±â  ±è¿µ´ë 2004/08/05 8064 1831
143   [½Ã½ºÅÛ] ÇÁ·Î±×·¥ Á¦°Å(Uninstall) ¸ñ·Ï ±¸ÇÏ±â  ±è¿µ´ë 2004/08/05 5459 1409
142   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Adobe Acrobat ÀÌ ¼³Ä¡µÇ¾ú´ÂÁö °Ë»çÇÏ±â  ±è¿µ´ë 2004/08/06 5032 1269
141   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Shockwave Flash °¡ ¼³Ä¡µÇ¾ú´ÂÁö °Ë»çÇÏ°í ¹öÀüÁ¤º¸ Àоî¿À±â  ±è¿µ´ë 2004/08/06 6513 1638
140   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Title bar ¿¡ ¹®ÀÚ ¿Ã¸®±â  ±è¿µ´ë 2004/08/06 5230 1395
139   [À©µµ¿ìÁî API] Type Library ¸ñ·Ï ±¸ÇÏ±â  ±è¿µ´ë 2004/08/06 5164 1381
138   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] º®¿¡ µé·¯ºÙ´Â ÀÚ¼®Æû ¸¸µé±â  ±è¿µ´ë 2004/08/06 5201 1293
137   [COM/OLE] Shockwave Flash ActiveX »ç¿ëÇϱ⠿¹Á¦  ±è¿µ´ë 2004/08/09 5494 1452
136   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼ö½Ä(Expression) °è»ê±â  ±è¿µ´ë 2004/08/09 6704 1263
  [³×Æ®¿÷/ÀÎÅͳÝ] Ping ¼Ò½º  ±è¿µ´ë 2004/08/09 7586 1380
134   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] µµ³Ó(Doughnut) ¸ð¾çÀÇ Æû ¸¸µé±â  ±è¿µ´ë 2004/08/09 5345 1319
133   [½Ã½ºÅÛ] Sleep Áß¿¡µµ ŸÀÌ¸Ó À̺¥Æ® ¹ß»ý½ÃÅ°±â  ±è¿µ´ë 2004/08/09 6546 1547
132   [À©µµ¿ìÁî API] IE Àӽà ÀÎÅÍ³Ý ÆÄÀÏ Æú´õ ºñ¿ì±â2  ±è¿µ´ë 2004/08/11 5547 1451

[ÀÌÀü 10°³] [1].. 21 [22][23][24][25]
 

Copyright 1999-2024 Zeroboard / skin by zero