Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAC Address
Message
From
05/08/1999 10:47:45
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00249967
Message ID:
00250159
Views:
30
>>>>Can you obtain the ethernet address using native VFP code? I found an article on how to do it in C and noticed that it uses structures. Has anyone done this?
>>>>
>>>
>>>The easiest ways are to either use the WinSock Active control to retrieve the MAC address through ActiveX automation, or to dump the output of IPCONFIG /ALL to a file and parse the results on a line-by-line basis (you can issue a command line switch to dump the output to a standard file; IPCONFIG /HELP will provide the basic details.)
>>>
>>>Realize that not all systems have real MAC addresses, and you may have more than one MAC address on systems with more than one LAN adapter.
>>>
>>>You can access Win32 API calls through VFP using structures built in static memory blocks; you can look at my CLSHEAP library, Paul-Vlad Tatavu's POINTERS class, and especially Christof Lange's STRUCT class to see several approaches to implementing structures beyond the simple declarations available directly through VFP's DECLARE...DLL syntax.
>>
>>Ed,
>>
>>The MAC address is available from IPCONFIG (NT) and WINIPCFG (95-98) and can easily be dumped to a file (although messy). I was unable to get Winsock to deliver the MAC address to me but it does have the IP address. I got your message while I was reading Christof's doc's and might play with that some (although it is beyond my current understanding).
>>
>>Since this question has been posted several times and the C code is provided in the Q118623 article - I figured it would be a snap for you <grin>...
>>
>
>The NetBIOS code in the article is not completely trivial; I haven't needed to implement anything in VFP that needed a MAC address, and in C++, I'd use the NdisReadNetworkAddress() API call IAC, which uses C++ style calling conventions and couldn't be called directly via VFP-only code. Maybe someone else has the time to develop the necessary classes for you.
>
>You might try looking for the value in the registry if you don't want to write the API code yourself and don't want to parse the output from IPCONFIG; try the HKEY_LOCAL_MACHINE\Enum subkeys.

Thanks Ed, maybe this winter when things settle down I will look some more at Christof's stucture class. I use third party libraries when I have to but there is nothing like native foxpro code...

...tim
Previous
Reply
Map
View

Click here to load this message in the networking platform