-
IPHelper API query
As per msdn we should use GetAdaptersAddresses() instead of GetAdaptersInfor() for Windows XP and later. I need to get all information for NIC ie: IP, Subnet, Gateway, DNS, WINS.
GetAdaptersInfo() does it all, but couldn't find any sample how to retrieve Gateway, Subnet using GetAdaptersAddresses(), Geteway address can be retrieved by GAA_FLAG_INCLUDE_GATEWAYS from Windows Vista, I need to code to support OS from XP, Can anyone suggest anything ?
-
Re: IPHelper API query
I believe nothing prevents you from using GetAdaptersInfo except that MS note. So forget about the note, but remember the limitation, IPv4 only.
-
Re: IPHelper API query
Hmm, currently in my case no reason to use GetAdaptersAddess over GetAdaptersInfo except msdn, cause I'm not gonna support IPv6.
-
Re: IPHelper API query
So give it a try, and let us know about your results. :)
-
Re: IPHelper API query
Will get back to this thread once I completed with GetAdaptersInfo and its testing on Xp, Vista, 7 including x64 version.
-
Re: IPHelper API query
So far I have completed other work except a few, what should be better approach to get the Connection name.
GetAdaptersInfo returns GUID for the NIC, if using this way to get Connection Name I have to read registry key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}'
GetAdaptersAddress returns FriendlyName of the NIC, ie: the Connection name
Which one will be better ?
Read registry
or
Use GetAdaptersAddress only for FriendlyName, along with GetAdaptersInfo for others.
-
Re: IPHelper API query
Just a small update. I tried both API in my sample application and application reaches using 6MB of memory where as using GetAdaptersInfo takes only 1.5MB memory.
Wasting 4.5MB memory only for retrieving one single information which can be queried from registry. Is it worthy using both APIs in single application.
Don't mention as its a desktop application I shouldn't care about memory. I like keep my application use only required memory.
-
Re: IPHelper API query
These days CodeGuru is inactive or Gurus didn't work with IPHelper much ? No such replies.