Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Network Adapter Address (MAC?)
Message
From
26/09/2001 17:49:36
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00477977
Message ID:
00561244
Views:
47
>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
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform