Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to retrieve a NIC Mac Address and its IP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00996178
Message ID:
00996540
Vues:
23
Hugo,
Things are getting more confusing now. Here is the code I have in C#
//System.String sQuery = "SELECT * FROM Win32_NetworkAdapter WHERE Availability = 3 AND MACAddress <> 'null' AND AdapterTypeID = 0";
				System.String sQuery = "SELECT * FROM Win32_NetworkAdapter";
				System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(sQuery);
				foreach (System.Management.ManagementObject nic in searcher.Get())
				{

					if (nic["NetConnectionID"] == null)
					{

						MessageBox.Show(nic["Description"].ToString()    + "\n" + "Availability = " + Convert.ToInt16(nic["Availability"]).ToString() + "\n" + "AdapterTypeID = " + Convert.ToInt16(nic["AdapterTypeID"]).ToString(), "Description");
					}
					else
					{
						MessageBox.Show(nic["NetConnectionID"].ToString() + "\n" + "Availability = " + Convert.ToInt16(nic["Availability"]).ToString() + "\n" + "AdapterTypeID = " + Convert.ToInt16(nic["AdapterTypeID"]).ToString(), "NetConnectionID");
					}
I am doing things very similar to you.
I did notice though that there are "records" in Win32_NetworkAdapter where NetConnectionID returns the name I have in the Network Connection Control Panel program but Availability is equal to 8 (off line) for these "records". Very strange.

Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform