Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetAdaptersAddresses
Message
From
19/08/2016 11:43:49
 
 
To
19/08/2016 10:45:21
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01639334
Message ID:
01639686
Views:
58
>>>I want to try out this API function:
>>>
>>>ULONG WINAPI GetAdaptersAddresses(
>>> _In_ ULONG Family,
>>> _In_ ULONG Flags,
>>> _In_ PVOID Reserved,
>>> _Inout_ PIP_ADAPTER_ADDRESSES AdapterAddresses,
>>> _Inout_ PULONG SizePointer
>>>);
>>>
>>>How do I use that in VFP?
>>>
>>>See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx for more detail
>>
>>If restricted to Vista and upwards, you may consider this alternative:
>>
>>
>>CLEAR
>>
>>LOCAL WMIService, AllNetworkAdapters, NetworkAdapter, MACAddress
>>
>>m.WMIService = GETOBJECT("winmgmts:\\.\root\cimv2")
>>
>>m.AllNetworkAdapters = m.WMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
>>
>>FOR EACH m.NetworkAdapter IN m.AllNetworkAdapters
>>	m.MACAddress = m.NetworkAdapter.MACAddress
>>	IF !ISNULL(m.MACAddress)
>>		? m.NetworkAdapter.name + ": " + m.MACAddress + " (" + IIF(m.NetworkAdapter.PhysicalAdapter,"","not ") + "physical)"
>>	ENDIF
>>ENDFOR
>>
>>
>>Complete set of properties at https://msdn.microsoft.com/en-us/library/aa394216(v=vs.85).aspx
>
>Antonio,
>
>thanks for pointing me in this direction. I am trying it out and am adjusting the code you provided to return all the physical MAC addresses. Do you know if they will always be returned in the same order (I am concatenating them into a string and would need them to always be in the same position in the string)?

Just a thought (since you use .NET) : You could use a COM wrapper for a net implementation (see System.Net.NetworkInformation)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform