Delphi Detect The Windows WiFi Networks In Your Delphi App With This Powerful Component Suite

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Detect The Windows WiFi Networks In Your Delphi App With This Powerful Component Suite
February 14, 2021 By Anbarasan

Nowadays accessing Wi-Fi networks information becomes common in our Desktop, Web, Mobile and IOT applications. Detecting the available or cached Wi-Fi networks information is no more a tough task from your code. Для просмотра ссылки Войди или Зарегистрируйся System Information Management Suite’s component helps to detect easily the Wi-Fi networks and we will learn how to use TMiTeC_WIFI component in the blog post.

Platforms: Windows.

Installation Steps:

You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
  1. Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Components in Categories->Components->Trail -MiTec system Information Component Suite 14.3 and click Install Button.
  2. Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? click yes and continue.
  3. It will download the plugin and installs it. Once installed Click Restart now.
How to run the Demo app:
  • Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi16
  • Open the SC project in RAD studio 10.4.1 compile and Run the application.
  • This Demo App shows how to detect the Wifi Networks and its properties such as Connected, MACAddress, MaxSpeed, etc.
Components used in MSIC SC Demo App:
  • TMiTeC_WiFi: Enumerates all detected or cached Wi-Fi networks and their properties.
  • TListView To list down the list of detected Wi-Fi networks.
Implementation Details:
  • An instance WiFi of TMiTeC_WIFI is created. Loop through the NetworkCount property to detect the available Wi-Fi networks. For each TWifiNetwork record list down the properties such as properties such as SignalQuality, SecurityEnabled, Connected, MACAddress, MaxSpeed, ChannelFreq in the list view.
Код:
procedure TwndMain.RefreshData;
var
  i: Integer;
  n: TListItem;
  s: string;
begin
  WIFI.RefreshData;
  lv.Items.BeginUpdate;
  try
    lv.Items.Clear;
    for i:=0 to lv.Items.Count-1 do
      lv.Items[i].SubItems[0]:='0%';
    for i:=0 to WIFI.NetworkCount-1 do begin
      s:=WIFI.Networks[i].SSID;
      if (s='') then
        s:=WIFI.Networks[i].Profile;
      n:=lv.FindData(0,Pointer(WIFI.Networks[i].ID),True,True);
      if not Assigned(n) then begin
        n:=lv.Items.Add;
        n.Caption:=s;
        n.SubItems.Add(Format('%d%%',[WIFI.Networks[i].SignalQuality]));
        n.SubItems.Add(AuthToStr(WIFI.Networks[i].AuthAlgorithm));
        n.SubItems.Add(CipherToStr(WIFI.Networks[i].CipherAlgorithm));
        n.SubItems.Add(PHYToStr(WIFI.Networks[i].PHYType));
        n.SubItems.Add(BSSToStr(WIFI.Networks[i].BSSType));
        n.SubItems.Add(WIFI.Networks[i].MACAddress);
        n.SubItems.Add(Format('%d dBm',[WIFI.Networks[i].RSSI]));
        n.SubItems.Add(Format('%1.3f GHz',[WIFI.Networks[i].ChannelFreq/1000000]));
        n.SubItems.Add(Format('%d',[GetChannelNumber(WIFI.Networks[i].ChannelFreq)]));
        n.SubItems.Add(Format('%d Mbps',[WIFI.Networks[i].MaxSpeed]));
        n.SubItems.Add(WIFI.Networks[i].Intf.Name);
        n.Data:=Pointer(WIFI.Networks[i].ID);
      end else begin
        n.SubItems[0]:=Format('%d%%',[WIFI.Networks[i].SignalQuality]);
        n.SubItems[5]:=WIFI.Networks[i].MACAddress;
        n.SubItems[6]:=Format('%d dBm',[WIFI.Networks[i].RSSI]);
        n.SubItems[7]:=Format('%1.3f GHz',[WIFI.Networks[i].ChannelFreq/1000000]);
        n.SubItems[8]:=Format('%d',[GetChannelNumber(WIFI.Networks[i].ChannelFreq)]);
        n.SubItems[9]:=Format('%d Mbps',[WIFI.Networks[i].MaxSpeed]);
      end;
      n.ImageIndex:=Integer(WIFI.Networks[i].SecurityEnabled);
      if WIFI.Networks[i].Connected then
        n.ImageIndex:=n.ImageIndex+2;
    end;
  finally
    lv.Items.EndUpdate;
  end;
end;
1613323564194.png
MiTeC WiFi Demo

It’s that simple to enumerate list of Wi-Fi networks and its properties available in your machine from your Delphi application. Use this MiTeC component suite and get the job done quickly.

Head over and check out the full MiTec System Information Management Suite for Access System Information for Windows in Delphi Applications