我的一段程序:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,winsock;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MacAddr:dword;
PhyAddrLen: DWORD;
ret,srcip,destip:dword; Form1: TForm1; function SendARP(DestIP: DWORD; SrcIP: DWORD; pMacAddr: PDWORD;
PhyAddrLen: PDWORD): DWORD; stdcall;external 'IPHlpAPI.DLL';
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
destip:=inet_addr(pchar(trim(edit1.Text)));
srcip:=inet_addr(pchar(trim(edit2.Text)));
ret:=SendARP(destip,srcip,@MacAddr,@phyAddrLen);
label3.Caption :=inttostr(MacAddr);
end;end.在调用SendARP时总是失败。那为DX给看看?谢谢
环境是win 2000+delphi 6
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,winsock;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MacAddr:dword;
PhyAddrLen: DWORD;
ret,srcip,destip:dword; Form1: TForm1; function SendARP(DestIP: DWORD; SrcIP: DWORD; pMacAddr: PDWORD;
PhyAddrLen: PDWORD): DWORD; stdcall;external 'IPHlpAPI.DLL';
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
destip:=inet_addr(pchar(trim(edit1.Text)));
srcip:=inet_addr(pchar(trim(edit2.Text)));
ret:=SendARP(destip,srcip,@MacAddr,@phyAddrLen);
label3.Caption :=inttostr(MacAddr);
end;end.在调用SendARP时总是失败。那为DX给看看?谢谢
环境是win 2000+delphi 6
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货