3
以下是我在Windows XP中获取默认网卡的代码,但是相同的代码在Windows 7中无法使用。阅读MSDN后真的让人感到困惑。任何解决方案Windows 7默认网络适配器
//----------------- Getting all the Nic's --------------------
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
//------------ Getting properties of IPV4 ----------------
IPInterfaceProperties ipProps = nic.GetIPProperties();
//------------ Getting the Ip Properties -----------------
if (ipProps.GetIPv4Properties() != null)
{
dic.Add(ipProps.GetIPv4Properties().Index, nic.Name);
}
错误:请求协议未配置或没有实现。
哪一行是你得到的错误? –