The Road to Delphi

Delphi – Free Pascal – Oxygene

Detecting Wifi Networks Using Delphi Prism.


The next code uses the Managed Wifi API, The library uses the Native Wifi API, available since Windows Vista and Windows XP SP2 (in a limited fashion, and only after applying a hotfix provided in KB article 918997). Older versions of Windows are not supported.

Before to compile the code you need to download the library from this location. Build the project “ManagedWifi.csproj” and then add the reference to the source code listed below.
namespace DelphiPrismWifidetection;
//Author : Rodrigo Ruz. 2009-09-29
//Shine Your crazy Diamond.


NativeWifi,//You must add the reference to the library ManagedWifi.dll

  ConsoleApp = class
    class method GetStringForSSID(ssid : Wlan.Dot11Ssid ) : string;
    class method GetStringFornumberOfBssids (numberOfBssids : Int32 ) : string;
    class method Main;


class method ConsoleApp.GetStringForSSID(ssid : Wlan.Dot11Ssid ) : string;
    Result:= Encoding.ASCII.GetString( ssid.SSID, 0, Int32( ssid.SSIDLength) );

class method ConsoleApp.GetStringFornumberOfBssids (numberOfBssids : Int32 ) : string;
  case numberOfBssids of
  1: Result:='infrastructure';
  2: Result:='independent';
  3: Result:='any';
  end; // case

class method ConsoleApp.Main;
            var client : WlanClient  := new WlanClient();
            for each  wlanIface in client.Interfaces  do
                var networks : Array of  Wlan.WlanAvailableNetwork  := wlanIface.GetAvailableNetworkList(NativeWifi.Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);
                for each  network in networks  do
                    // for more info goto
                    Console.WriteLine( "┌---------------------------------------------------------------¬");
                    Console.WriteLine( "|Network Detected      {0,-40} |", GetStringForSSID(network.dot11Ssid));
                    Console.WriteLine( "├---------------------------------------------------------------┤");
                    Console.WriteLine( "| CipherAlgorithm      {0,-40} |", network.dot11DefaultCipherAlgorithm.ToString());
                    Console.WriteLine( "| DefaultAuthAlgorithm {0,-40} |", network.dot11DefaultAuthAlgorithm.ToString());
                    Console.WriteLine( "| dot11Ssid            {0,-40} |", network.dot11Ssid.ToString());
                    Console.WriteLine( "| networkConnectable   {0,-40} |", network.networkConnectable.ToString());
                    if not network.networkConnectable then
                    Console.WriteLine( "| NotConnectableReason {0,-40} |", network.wlanNotConnectableReason.ToString());
                    Console.WriteLine( "| morePhyTypes         {0,-40} |", network.morePhyTypes.ToString());
                    Console.WriteLine( "| (BSS) network type   {0,-40} |", GetStringFornumberOfBssids(network.numberOfBssids));
                    Console.WriteLine( "| profileName          {0,-40} |", network.profileName.ToString());
                    Console.WriteLine( "| securityEnabled      {0,-40} |", network.securityEnabled.ToString());
                    Console.WriteLine( "| wlanSignalQuality    {0,-40} |", network.wlanSignalQuality.ToString());
                    Console.WriteLine( "└---------------------------------------------------------------┘");



and the result is


Download the full source code from here


Author: Rodrigo

Just another Delphi guy.

13 thoughts on “Detecting Wifi Networks Using Delphi Prism.

  1. I followed the guideline you gave but it dint work.. what could i have done wrong?

  2. Please could you send me your already made project via email? pls

  3. I downloaded the source code but i encountered an error “Cannot open because of its project type(.oxygene) is not supported is this version of Visual Studio”. Please what version of visual studio did you use? or which software did you use if its not visual studio.

  4. Okay but how do i use is will it run on vista?

  5. Rodrigo, first at all, thanks for posting the wifi code. Can you please update the download link? It seems to be that it is not longer available. Thanks!

  6. there was a similar version you made that worked in windows xp. i forget the exact link. but after a reinstall of xp home, and reruning this app, (no change in app) i am no longer able to see wife networks. did i install something inititially when i was compiling your other project that i need to reinstall ?

  7. i found the link. this is the project that i compiled under delphi 6. the app does not work on my xp home desk pc, but does work on my laptops.

  8. i miss being able to use that app. i made changes to it to run in window instead of dos console. looks better. but i can only use it on laptops and other pc’s. i removed something when i reinstalled windows xp home, but i would not know what it is. anyway. i’m unable to pass the Genuine Windows test, so it won’t let me download the “WindowsXP-KB918997-v6-x86-ENU.exe” file. if that is the file i need (and to install) to get this project working, is there another place i can download it from ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s