谁知道IP HELPER API中SENDARP函数的用法
谁知道IP HELPER API中SENDARP函数的用法
楼主zhangquan666666(成全)2003-06-05 20:38:43 在 Delphi / 网络通信/分布式开发 提问 谁知道IP HELPER API中SENDARP函数的用法,我在DELPHI中调用IPHLPAPI.DLL但它告诉我SENDARP函数没有被初始化!这是什么意思?下面附有源代码!unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,winsock;
type
Tsendarp= function(destIP:integer;SrcIP :integer;pMacAddr:longint;PhyAddrLen:longint):Dword;stdcall;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Wsadata:Twsadata;
begin
WSAStartup($101,wsadata);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Wsacleanup();
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hmacaddressdll:HMODULE;
sendarp:Tsendarp;
macaddress:arrayof char;
ip:integer;
i: integer;
p:^char;
begin
p:=@macaddress;
ip:=inet_addr(pchar(edit1.Text ));
hmacaddressdll:=loadlibrary("iphlpapi.dll");
if Hmacaddressdll=0 then
label1.Caption :="动态联接库连接错误"
else
@sendarp:=GetProcAddress(Hmacaddressdll,"SendARP");
sendarp(ip,0,longint(p),6);
label1.Caption :="";
label1.Caption:=macaddress;
label2.Caption :=macaddress;
end;
end.
问题点数:0、回复次数:0Top
-
相关文章
2秒记住本站域名
玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn
