Anyone got any code for retrieving a MAC address for a network card?
I have been using the code posted at VBNet and Microsoft however I have noticed that unless the network card is physically plugged into the LAN then it returns zero values for the address. It seems to happen using Win98 and Win2000. WinNT4 is fine.
If anyone has any fail save methods for returning the correct MAC let me know.
I am using the MAC for software licensing purposes.
See the attached file -it's the only way I know how to do it and it works on NT and win2K.
Basically, I call ipconfig /all then parse it for the address.
I wrote this a while ago, so I dump the ipconfig results to a file then parse that.
If you come up with a simple way to do it without the file, let me know.
(I haven't touched this code in a long time...)
This will give you the Physical Address of the nic card.