Get SSID of the wireless network I am connected to with C# .Net on Windows Vista

后端 未结 7 764
难免孤独
难免孤独 2020-11-27 04:31

I\'d like to know if there is any .Net class that allows me to know the SSID of the wireless network I\'m connected to. So far I only found the library linked below. Is the

相关标签:
7条回答
  • 2020-11-27 05:35

    It looks like this will do what you want:

    ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI",
    "SELECT * FROM MSNdis_80211_ServiceSetIdentifier");
    
    
    foreach (ManagementObject queryObj in searcher.Get())
    {
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("MSNdis_80211_ServiceSetIdentifier instance");
        Console.WriteLine("-----------------------------------");
    
        if(queryObj["Ndis80211SsId"] == null)
            Console.WriteLine("Ndis80211SsId: {0}",queryObj["Ndis80211SsId"]);
        else
        {
            Byte[] arrNdis80211SsId = (Byte[])
            (queryObj["Ndis80211SsId"]);
            foreach (Byte arrValue in arrNdis80211SsId)
            {
                Console.WriteLine("Ndis80211SsId: {0}", arrValue);
            }
        }
    }
    

    from http://bytes.com/groups/net-c/657473-wmi-wifi-discovery

    0 讨论(0)
提交回复
热议问题