Nowadays, accessing Wi-Fi networks is becoming common in our Desktop, Web, Mobile, and IoT applications. Detecting available or cached Wi-Fi network information is no longer a tough task for your code. MiTec’s System Information Management Suite’s component helps to detect 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.
- 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.
- 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.
- 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
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; |
It’s that simple to enumerate a list of Wi-Fi networks and their properties available in your machine from your Delphi application. Use this MiTeC component suite and get the job done quickly.
With the use of a Windows IDE, you can easily detect the windows wifi networks in your Delphi app with a component suite. Try your Free Trial here.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition