在Delphi中使用TidIcmpClient控件可以非常简单的实现图形界面的Ping!
新建一个工程,命名为PingGUI.dpr,窗口命名为“frmPing”,加入如下组件:
lstReplies: TListBox;
ICMP: TIdIcmpClient;
Panel1: TPanel;
btnPing: TButton;
edtHost: TEdit;
spnPing: TSpinEdit;
Label1: TLabel;
完整源代码如下:
unit Main;
interface
uses
Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
SysUtils, Classes, IdIcmpClient, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
...[ 查看全文 ]