C# Network Adapter Cable unplugged or Adapter Disabled -
i creating winforms app view details of different network adapters , connections. using "win32_networkadapter" , "win32_networkadapterconfiguration" classes.
one of features display current status of adapter whether enabled or disabled. , using info can enable or disable adapter.
the problem have when adapter enabled , connected works fine, when adapter disabled or when cable disconnected shows disabled.
how can check enabled adapter unplugged network cable see inside windows network , sharing center >>> adapter settings.
used in 1 project, in windows xp times...
system.management.managementobjectsearcher searcher = new system.management.managementobjectsearcher("select netconnectionstatus win32_networkadapter"); foreach (system.management.managementobject networkadapter in searcher.get()) { if (networkadapter["netconnectionstatus"] != null) { if (convert.toint32(networkadapter["netconnectionstatus"]).equals(2)) { connected = true; break; } } }
Comments
Post a Comment