摘要:
添加 system32.Management引用private bool ListenNET() { ManagementObjectSearcher s = new ManagementObjectSearcher(@"SELECT DeviceID FROM Win32_NetworkAdapter WHERE NetConnectionStatus=2 AND PNPDeviceID LIKE 'PCI%'"); return s.Get().Count > 0; //True表示存在已连接的真实网卡,False反之。 } 阅读全文