Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
AnswerRe: Benefits of SqlTypes? Pin
Heath Stewart23-Nov-04 12:48
protectorHeath Stewart23-Nov-04 12:48 
GeneralRe: Benefits of SqlTypes? Pin
Charlie Williams23-Nov-04 13:12
Charlie Williams23-Nov-04 13:12 
GeneralRe: Benefits of SqlTypes? Pin
Heath Stewart23-Nov-04 13:13
protectorHeath Stewart23-Nov-04 13:13 
GeneralC# Question Pin
QzRz23-Nov-04 9:19
QzRz23-Nov-04 9:19 
GeneralRe: C# Question Pin
Stefan Troschuetz23-Nov-04 9:57
Stefan Troschuetz23-Nov-04 9:57 
GeneralRe: C# Question Pin
Uwe Keim23-Nov-04 19:56
sitebuilderUwe Keim23-Nov-04 19:56 
GeneralInstalled network cards Pin
Einar Kvandahl23-Nov-04 7:38
Einar Kvandahl23-Nov-04 7:38 
GeneralRe: Installed network cards Pin
Heath Stewart23-Nov-04 12:45
protectorHeath Stewart23-Nov-04 12:45 
Windows Management Interfaces (WMI) is your answer, and can be queried using the System.Management classes. Specifically, the CIMv2 class (not a .NET class) Win32_NetworkAdapter is what you want to enumerate and query. To do that, you use a ManagementObjectSearcher:
using System;
using System.Management;
 
class Test
{
  static void Main()
  {
    ManagementObjectSearcher searcher = new ManagementObjectSearcher(
      "select * from Win32_NetworkAdapter");
    foreach (ManagementObject nic in searcher.Get())
    {
      Console.WriteLine("Name: " + nic["Name"]);
      Console.WriteLine("Network connection ID: " +
        nic["NetConnectionID"]);
      Console.WriteLine("Status: " + nic["NetConnectionStatus"]);
      Console.WriteLine();
    }
  }
}
You can install the Management Classes and Events add-in for either VS.NET 2002 or 2003 from http://msdn.microsoft.com[^] and actually create typed classes for whatever WMI classes you want, too.

For more information, search for "WMI" by clicking "Search comments". I've talked about this topic quite a bit and have given links to much more information over the course of the last couple years.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: Installed network cards Pin
Einar Kvandahl24-Nov-04 3:59
Einar Kvandahl24-Nov-04 3:59 
GeneralRe: Installed network cards Pin
Heath Stewart24-Nov-04 5:06
protectorHeath Stewart24-Nov-04 5:06 
QuestionMore-Automated Windows Forms Help? Pin
McClamm23-Nov-04 7:08
McClamm23-Nov-04 7:08 
AnswerRe: More-Automated Windows Forms Help? Pin
Heath Stewart23-Nov-04 8:47
protectorHeath Stewart23-Nov-04 8:47 
Generalcatch app Exit Pin
IvyLee23-Nov-04 6:28
IvyLee23-Nov-04 6:28 
GeneralRe: catch app Exit Pin
Daniel Turini23-Nov-04 8:10
Daniel Turini23-Nov-04 8:10 
GeneralToolbar Pin
nickthemiragorobot23-Nov-04 5:44
nickthemiragorobot23-Nov-04 5:44 
GeneralRe: Toolbar Pin
Luis Alonso Ramos23-Nov-04 10:43
Luis Alonso Ramos23-Nov-04 10:43 
GeneralAvoiding multiple instances of an Application Pin
sommarafton23-Nov-04 3:43
sommarafton23-Nov-04 3:43 
GeneralRe: Avoiding multiple instances of an Application Pin
Jesse Squire23-Nov-04 3:56
Jesse Squire23-Nov-04 3:56 
GeneralTwo dimensional strongly typed collection Pin
Jan R Hansen23-Nov-04 3:36
Jan R Hansen23-Nov-04 3:36 
GeneralRe: Two dimensional strongly typed collection Pin
benjymous23-Nov-04 5:08
benjymous23-Nov-04 5:08 
GeneralRe: Two dimensional strongly typed collection Pin
Jan R Hansen23-Nov-04 5:51
Jan R Hansen23-Nov-04 5:51 
GeneralRe: Two dimensional strongly typed collection Pin
benjymous23-Nov-04 21:54
benjymous23-Nov-04 21:54 
GeneralCalling constructors Pin
pjholliday23-Nov-04 2:57
pjholliday23-Nov-04 2:57 
GeneralRe: Calling constructors Pin
S. Senthil Kumar23-Nov-04 3:12
S. Senthil Kumar23-Nov-04 3:12 
GeneralRe: Calling constructors Pin
Heath Stewart23-Nov-04 6:06
protectorHeath Stewart23-Nov-04 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.