Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: GetAdaptersInfo - AdapterName - shows GUID instead of real name
| Subject: | Re: GetAdaptersInfo - AdapterName - shows GUID instead of real name |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Mon, 2 Oct 2006 14:03:34 |
"Dieter_Soergel" <google@dscs.de> wrote in message
news:1159791856.349810.7240@b28g2000cwb.googlegroups.com...
> Description shows me the name of the Aapter:
> "Intel(R) PRO/Wireless 2200BG N...."
As it should be. You are enumerating the physical network adapters, so you
are getting the friendly names of the hardware.
> But I need something like that:
> "Local Area Connection"
>
> which is also displayed in Network Settings:
You are looking in the wrong place to begin with. GetAdaptersInfo() returns
the physical adapters that manage the networks that the machine is
physically connected to. To loop through the logical connections that use
those adapters internally, try using WNetOpenEnum() and WNetEnumResource()
instead.
If that doesn't work, then you will have to do the same thing that Windos
Explorer itself does:
1) Use SHGetDesktopFolder() to get the IShellFolder interface for the
top-level Shell namespace.
2) Use SHGetSpecialFolderLocation(), specifying CSIDL_CONNECTIONS, to get
the ITEMIDLIST of the "Network Connections" folder.
3) Pass the ITEMIDLIST to the BindToObject() method of the desktop's
IShellFolder interface to get the IShellFolder interface for the "Network
Connections" folder.
4) Use the EnumObjects() method of the "Network Connections" IShellFolder
interface to get an IEnumIDList interface for the enumerator that will loop
through the individual items in the folder.
5) Use the GetDisplayNameOf() method of the "Network Connections"
IShellFolder interface to get the friendly name of each item that the
enumerator returns.
Gambit
none