110,538
社区成员
发帖
与我相关
我的任务
分享
[DllImport("packet.dll", EntryPoint = "PacketGetAdapterNames", CharSet = CharSet.Ansi)]
public static extern bool PacketGetAdapterNames([MarshalAs(UnmanagedType.LPStr)]string sStr, ref int BufferSize);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
bool b = false;
int length = 40;
string an = new string('0', length);
b = PacketGetAdapterNames(an, ref length);
//NetworkInterface[] ni = NetworkInterface.GetAllNetworkInterfaces();
label1.Text = an;
}