No announcement yet.

Some Windows XP WMI Wireless Code

  • Filter
  • Time
  • Show
Clear All
new posts

  • Some Windows XP WMI Wireless Code

    I got a PM asking for some code on the wireless Im using. I will post it here. I did NOT make the entire code I found it some where on the internet looking for some bits and pieces of random code to add to my project, and adapted it for VB6.

    Private Sub wifitimer_Timer()
    Dim objSwbemServices, colInstances, obj, rawssid, ssid, i, decval
    On Error Resume Next
    Set objSwbemServices = GetObject("winmgmts:\\.\root\wmi")
    Set colInstances = objSwbemServices.ExecQuery("SELECT * FROM MSNDis_80211_BSSIList")
    For Each obj In colInstances
    If Left(obj.InstanceName, 4) <> "WAN " And Right(obj.InstanceName, 8) <> "Miniport" Then
    For Each rawssid In obj.Ndis80211BSSIList
    ssid = ""
    For i = 0 To UBound(rawssid.Ndis80211Ssid)
    decval = rawssid.Ndis80211Ssid(i)
    If (decval > 31 And decval < 127) Then
    ssid = ssid & Chr(decval)
    End If
    wifilist.AddItem (ssid)
    Dim A%, B%
    For A% = 0 To wifilist.ListCount - 1
    For B% = 0 To wifilist.ListCount - 1
    If B% <> A% Then
    If wifilist.List(A%) = wifilist.List(B%) Then
    wifilist.RemoveItem B%
    B% = B% - 1
    End If
    End If
    Next B%
    Next A%
    End If
    End Sub
    Was the code that I put in a listbox and removes duplicates. Help with that came from (Ninja Monkey). <-- VB6 Source With textbox. Pulls duplicates from WMI. Would be great if no duplicates were pulled. <-- Compiled program. <-- Required DLL file for GPS functions. (Place in Windows folder, you can delete anytime you want, it does popup when you first run the program to say its unregistered, but works as a quick gps for now) <-- VB6 Source with Listbox instead of Textbox. Pulls duplicates from WMI then removes them on the fly. This is the current one Im using. There is a compiled version included in the zip.