Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Network Adapter Address (MAC?)
Message
 
 
To
26/09/2001 17:49:36
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00477977
Message ID:
00561312
Views:
44
>>I could but that is too messy and I don't like the COMMAND window flash across the screen. The OCX from CompuServer that Rick Bean alerted me to does the trick flawlessly.
>
>Based on original solution (the MAC address is only part of the GUID):
>
>function GetMAC
>local lcStrucGUID, lcMAC, lnLoop
>declare integer CoCreateGuid in Ole32.dll string @lcGUIDStruc
>
>lcStrucGUID=space(16)
>
>if CoCreateGuid(@lcStrucGUID) # 0 then
>   return ""
>endif
>lcMAC = ""
>for lnLoop=11 to 16
>	lcMAC = lcMAC+right(transform(asc(substr(lcStrucGUID,lnLoop,1)),"@0"),2)+"-"
>endfor
>
>return left(lcMAC,len(lcMAC)-1)
>
>
>It works in my system (got my NIC MAC perfectly).
>
>bye

It can be reliable on some machines, but I have already demonstrated on several computers that it is very unreliable. I ran that code on my PC over 20 times in a loop and inserted the entire return value strings in a table. No part of the string was ever duplicated in other records and not 1 had any semblance of my MAC Address.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform