Recent

Author Topic: Get network name - LAN or WiFi (SSID)  (Read 9020 times)

JD

  • Hero Member
  • *****
  • Posts: 1848
Get network name - LAN or WiFi (SSID)
« on: April 18, 2014, 08:27:56 pm »
Hi there everyone,

I need to get the network name - LAN or WiFi (SSID) - used by a computer for connecting to the Internet in an application I wrote. I know how to get IP addresses & host name but I don't know how to get the network name.

I need all the help I can get.

Thanks,

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Get network name - LAN or WiFi (SSID)
« Reply #1 on: April 18, 2014, 09:42:07 pm »
2 solutions that I know of depending on what need to find
1) http://msdn.microsoft.com/en-us/library/windows/desktop/aa371415%28v=vs.85%29.aspx
See if that gives you the info you need, and
2) use WMI to get the information you need http://www.delphipages.com/forum/showthread.php?t=141723
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Get network name - LAN or WiFi (SSID)
« Reply #2 on: April 19, 2014, 07:22:31 am »
@taazz Thanks a lot!

I just found this web page http://theroadtodelphi.wordpress.com/2011/04/21/accesing-the-wmi-from-delphi-and-fpc-via-com-without-late-binding-or-wbemscripting_tlb/
I'll be exploring it in depth.

However I'll need a similar solution for Linux also. Do you know of a cross-platform way of doing this? I always thought such low level functionality is available in the Free Pascal source units. Am I mistaken or do you know if such units exist?

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Get network name - LAN or WiFi (SSID)
« Reply #3 on: April 19, 2014, 07:59:54 am »
1) network names are a very OS specific feature, with no real value in applications other than network managing that is and it is not present in all OS for example I have never heard linux to have such thing you can enumerate the interfaces if you need but it does not attach network names to each interface as windows does that I know of.

2) I have no idea, FPC/lazarus might have something to enumerate interfaces (aka net/wifi cards) but I doubt it has something to retrieve the user friendly name aka network name of an interface.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018