Results 1 to 9 of 9

Thread: I've gotten so far yet...

  1. #1
    Low Bitrate Zharvek's Avatar
    Join Date
    Jan 2005
    Posts
    71

    Post I've gotten so far yet...

    Im making a small interface for my Carputer. I have gathered resources across the internet for this project and gotten it to work nicely. The problem is that Im stuck at a part that I can find little help on. I'm hoping that some of my fellow carputer people might be able to help me with.

    I have some code that reads Windows XPs WMI for Wireless Networks in the area. The WMI pulls down and then lists the APs SSID in a large text box. The problem is that WMI and my code are pulling down the same AP name multiple times if the AP is in reach, and I need it to only list the AP once.

    Some code:

    Code:
    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
    Next
    wifilist.SelStart = Len(wifilist.Text)
    wifilist.SelText = ssid & vbCrLf
    Next
    End If
    Next
    End Sub
    That will pull down the names like...

    Default
    Default
    Default
    Wireless
    Home
    Home
    Default
    Wireless

    and so on, can I somehow load this into an array of some sort and take out the duplicates? Thanks.

    If anyone needs my entire program for some reason just ask and I will post it.

    Thanks

  2. #2
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    here's a quick way of doing it from a listbox, I'm sure you can adapt it for an array

    Code:
    Private Sub Command2_Click()
    
        Dim A%, B%
    
        For A% = 0 To listBox.ListCount - 1
            For B% = 0 To listBox.ListCount - 1
                If B% <> A% Then
                    If listBox.List(A%) = listBox.List(B%) Then
                        listBox.RemoveItem B%
                        B% = B% - 1
                    End If
                End If
            Next B%
        Next A%
    
    End Sub
    Destinator 3 For PC! - http://www.map-monkey.co.uk/

  3. #3
    Low Bitrate Zharvek's Avatar
    Join Date
    Jan 2005
    Posts
    71
    Thanks, I made it into a list and your code is working nicely so far. I only have one AP in my area, so I will have to drive around, or walk about with my 'test' laptop to see how it handles two or more different APs in the list.

    ...Anyway to remove the border of this listbox, already set to 'flat' but still has that 1px border?

    Thanks again!

  4. #4
    I'm sorry, and you are....? frodobaggins's Avatar
    Join Date
    Jan 2003
    Location
    Ruston, LA
    Posts
    8,846
    try

    SELECT DISTINCT
    [H]4 Life
    My next generation Front End is right on schedule.
    It will be done sometime in the next generation.
    I'm a lesbian too.
    I am for hire!

  5. #5
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    heh, I didn't even notice he was using an SQL statement, even easier!
    Destinator 3 For PC! - http://www.map-monkey.co.uk/

  6. #6
    Low Bitrate Zharvek's Avatar
    Join Date
    Jan 2005
    Posts
    71
    Holy Crap, I will try that now, I never thought of it that way. (I use PHP and MySQL all the time) SQL!

  7. #7
    Low Bitrate Zharvek's Avatar
    Join Date
    Jan 2005
    Posts
    71

    Unhappy

    :-( It didnt work. I just added

    Code:
    Set colInstances = objSwbemServices.ExecQuery("SELECT DISTINCT * FROM MSNDis_80211_BSSIList")
    the DISTINCT but it does not return any data.

    It was a good try, (works great with PHP and MySQL), but for now its the list box... (with a border, lol).

    Any more ideas would be great.

    http://files.archaicbinary.net/Waynibu.zip <-- VB6 Source With textbox. Pulls duplicates from WMI. Would be great if no duplicates were pulled.

    http://files.archaicbinary.net/Project1.exe <-- Compiled program.

    http://files.archaicbinary.net/GPSV77K.DLL <-- 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)

  8. #8
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    What do you use GPS for?
    Destinator 3 For PC! - http://www.map-monkey.co.uk/

  9. #9
    Low Bitrate Zharvek's Avatar
    Join Date
    Jan 2005
    Posts
    71
    Just displays your Long, Lat, Speed, Alt on the screen.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •