这段代码是调用外部的dll 可能是c++开发的,也可能是其他语言开发的,这都没关系,楼主现在提供的代码有两个API
[DllImport("Iphlpapi.dll")]
private static extern int SendARP(Int32 dest, Int32 host, ref Int64 mac, ref Int32 length);
[DllImport("Ws2_32.dll")]
private static extern Int32 inet_addr(string ip);
这个在C#里相当于声明引用
然后在调用的时候,直接往里传参数就行了
比如说: int result_1 =0;
int result_2=0;
SendARP(1,2,ref result_1,ref result_2);
这个参数里面的ref result_1,ref result_2才是他返回来的真证的数据
另一个API同理。
Label.Text=(类名).GetCustomerMac("192.168.1.1")
public static string GetCustomerMac(string IP)这个方法里面的参数就是传你的IP, Label3.Text == GetIp();那么 Label4.Text ==GetCustomerMac(GetIp());其中Label4是你的控件,随便命名。