Delphi编程实现Ping操作(2) Data: Pointer; Options: TIPOptionInformation; end; TIcmpCreateFile = function: THandle; stdcall; TIcmpCloseHandle = function(IcmpHandle: THandle): Boolean; stdcall; TIcmpSendEcho = function(IcmpHandle:THandle; DestinationAddress: DWord; RequestData: Pointer; RequestSize: Word; RequestOptions: PIPOptionInformation; ReplyBuffer: Pointer; ReplySize: DWord; Timeout: DWord ): DWord; stdcall; TMyPing = class(TForm) Panel1: TPanel; Label1: TLabel; PingEdit: TEdit; ExeBtn: TButton; Button2: TButton; Button3: TButton; StatusShow: TMemo; procedure Button3Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ExeBtnClick(Sender: TObject); private { Private declarations } hICMP: THANDLE; IcmpCreateFile : TIcmpCreateFile; IcmpCloseHandle: TIcmpCloseHandle; IcmpSendEcho: TIcmpSendEcho; public { Public declarations } end; procedure TMyPing.FormCreate(Sender: TObject); var WSAData: TWSAData; hICMPdll: HMODULE; begin WSAStartup($101, WSAData); // Load the icmp.dll stuff hICMPdll := LoadLibrary('icmp.dll'); @ICMPCreateFile := GetProcAddress(hICMPdll, 'IcmpCreateFile'); @IcmpCloseHandle := GetProcAddress(hICMPdll, 'IcmpCloseHandle');