Results 1 to 6 of 6

Thread: Getting stats from wireless card

  1. #1
    Newbie
    Join Date
    Jan 2006
    Posts
    27

    Getting stats from wireless card

    I didn't see this covered in any depth so far, so here goes...

    What I'm looking to do is get a list of detected access points from the wireless card and then attempt connection to the ones that are not encrypted. If an ip address is assigned by that AP then do an event. Such as play a sound, popup a box, etc.

    I haven't found anything on this specifically from searching google. I'm thinking it may come down to trying to get objects from the cards drivers and approach it that way.

    Anyone have any thoughts on doing that?

    Thanks,
    James

  2. #2
    Newbie
    Join Date
    Jun 2006
    Location
    Louisville, KY
    Posts
    6

    I'm currently on the same hunt...

    I'll let you know if I come up with anything clever.

  3. #3
    Variable Bitrate
    Join Date
    Apr 2006
    Location
    Dallas, Texas
    Posts
    264
    Language?

  4. #4
    Newbie
    Join Date
    Jun 2006
    Location
    Louisville, KY
    Posts
    6
    The app is written in VB6, but I'm porting it to .NET, so either is fine with me if you have any info

  5. #5
    Maximum Bitrate Jarrod's Avatar
    Join Date
    Jan 2002
    Location
    Melb, Australia.
    Posts
    475
    Here is a little bit of VB.NET code I wrote a while ago to list the available SSID's. This only worked once Windows Wireless Config had picked up the list of networks though, so not sure how much help it will be.

    Code:
    Imports System.Management
    Imports System.Text
    Imports System.IO
    
    
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
    #Region " Windows Form Designer generated code "
    
        Public Sub New()
            MyBase.New()
    
            'This call is required by the Windows Form Designer.
            InitializeComponent()
    
            'Add any initialization after the InitializeComponent() call
    
        End Sub
    
        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
    
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
    
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents lblHomeNetwork As System.Windows.Forms.Label
        Friend WithEvents lblAvailable As System.Windows.Forms.Label
        Friend WithEvents btnSearch As System.Windows.Forms.Button
        Friend WithEvents lstAvailable As System.Windows.Forms.ListBox
        Friend WithEvents txtHome As System.Windows.Forms.TextBox
        Friend WithEvents statusBar As System.Windows.Forms.StatusBar
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.lstAvailable = New System.Windows.Forms.ListBox
            Me.txtHome = New System.Windows.Forms.TextBox
            Me.lblHomeNetwork = New System.Windows.Forms.Label
            Me.lblAvailable = New System.Windows.Forms.Label
            Me.btnSearch = New System.Windows.Forms.Button
            Me.statusBar = New System.Windows.Forms.StatusBar
            Me.SuspendLayout()
            '
            'lstAvailable
            '
            Me.lstAvailable.ItemHeight = 16
            Me.lstAvailable.Location = New System.Drawing.Point(12, 88)
            Me.lstAvailable.Name = "lstAvailable"
            Me.lstAvailable.Size = New System.Drawing.Size(219, 100)
            Me.lstAvailable.TabIndex = 0
            '
            'txtHome
            '
            Me.txtHome.Location = New System.Drawing.Point(12, 40)
            Me.txtHome.Name = "txtHome"
            Me.txtHome.Size = New System.Drawing.Size(219, 22)
            Me.txtHome.TabIndex = 1
            Me.txtHome.Text = ""
            '
            'lblHomeNetwork
            '
            Me.lblHomeNetwork.Location = New System.Drawing.Point(12, 19)
            Me.lblHomeNetwork.Name = "lblHomeNetwork"
            Me.lblHomeNetwork.Size = New System.Drawing.Size(219, 19)
            Me.lblHomeNetwork.TabIndex = 2
            Me.lblHomeNetwork.Text = "Home Network:"
            '
            'lblAvailable
            '
            Me.lblAvailable.Location = New System.Drawing.Point(12, 68)
            Me.lblAvailable.Name = "lblAvailable"
            Me.lblAvailable.Size = New System.Drawing.Size(219, 19)
            Me.lblAvailable.TabIndex = 3
            Me.lblAvailable.Text = "Available Networks:"
            '
            'btnSearch
            '
            Me.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.System
            Me.btnSearch.Location = New System.Drawing.Point(68, 196)
            Me.btnSearch.Name = "btnSearch"
            Me.btnSearch.Size = New System.Drawing.Size(107, 31)
            Me.btnSearch.TabIndex = 4
            Me.btnSearch.Text = "Search"
            '
            'statusBar
            '
            Me.statusBar.Location = New System.Drawing.Point(0, 244)
            Me.statusBar.Name = "statusBar"
            Me.statusBar.Size = New System.Drawing.Size(245, 22)
            Me.statusBar.TabIndex = 5
            '
            'Form1
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
            Me.ClientSize = New System.Drawing.Size(245, 266)
            Me.Controls.Add(Me.statusBar)
            Me.Controls.Add(Me.btnSearch)
            Me.Controls.Add(Me.lblAvailable)
            Me.Controls.Add(Me.lblHomeNetwork)
            Me.Controls.Add(Me.txtHome)
            Me.Controls.Add(Me.lstAvailable)
            Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
            Me.MaximizeBox = False
            Me.Name = "Form1"
            Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide
            Me.Text = "WirelessMan"
            Me.ResumeLayout(False)
    
        End Sub
    
    #End Region
    
        Dim bFoundNetworks As Boolean = False
    
        Private Sub SearchNetworks()
            lstAvailable.Items.Clear()
            lstAvailable.Items.Add("Searching...")
    
            Try
                Dim query As String = "SELECT * FROM MSNDis_80211_BSSIList WHERE Active='True'"
                Dim searcher As ManagementObjectSearcher = _
                     New ManagementObjectSearcher("root/WMI", query)
                Dim moc As ManagementObjectCollection = searcher.Get()
    
                Dim moe As ManagementObjectCollection.ManagementObjectEnumerator = moc.GetEnumerator()
                moe.MoveNext()
                Dim objarr() As ManagementBaseObject = CType(moe.Current.Properties("Ndis80211BSSIList").Value, ManagementBaseObject())
    
                lstAvailable.Items.Clear()
                For Each obj As ManagementBaseObject In objarr
                    bFoundNetworks = True
                    Dim ssid() As Char = Encoding.ASCII.GetChars(CType(obj("Ndis80211Ssid"), Byte()))
                    lstAvailable.Items.Add(New String(ssid))
                Next
                If lstAvailable.Items.Count = 0 Then
                    lstAvailable.Items.Add("No networks found!")
                End If
            Catch ex As ManagementException
                ' Wireless device disabled
                lstAvailable.Items.Clear()
                lstAvailable.Items.Add("Wireless device disabled!")
            Catch ex As System.NullReferenceException
                ' Windows hasnt searched for wireless networks yet
                bFoundNetworks = False
                lstAvailable.Items.Add("Windows must search...")
            End Try
    
        End Sub
    
        Private Sub CheckShare(ByVal strPath As String)
    
            'Inherits System.IO.FileSystemInfo
    
            Dim mobjFileInfo As FileInfo
            Dim mobjDirectoryInfo As DirectoryInfo
            Dim mblnIsDirectory As Boolean = True
            Try
                mobjDirectoryInfo = New DirectoryInfo(strPath)
    
            Catch ex As Exception
                Console.WriteLine(ex.ToString())
            End Try
    
            If mobjDirectoryInfo.Exists Then
                MsgBox("share exists!")
            Else
                MsgBox("share doesnt exist!")
            End If
    
    
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            txtHome.Text = "Please select a network..."
            'SearchNetworks()
            CheckShare("c:\Mp3")
            CheckShare("\\Terabyte\200gb (c)\MP3")
        End Sub
    
        Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
            SearchNetworks()
        End Sub
    
        Private Sub lstAvailable_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstAvailable.SelectedIndexChanged
            If (bFoundNetworks) Then
                txtHome.Text = lstAvailable.Items.Item(lstAvailable.SelectedIndex)
            End If
        End Sub
    End Class
    Jarrod - Holden VX S!

  6. #6
    Variable Bitrate
    Join Date
    Apr 2006
    Location
    Dallas, Texas
    Posts
    264
    I found this control for .NET to detect wireless networks, but it was designed for the compact framework. You might want to look into it.

    http://www.pocketpcdn.com/libraries/...perceptor.html

Similar Threads

  1. Trouble with PCI video card install ... help!!!
    By DonkeyBoy in forum General Hardware Discussion
    Replies: 4
    Last Post: 08-10-2005, 04:22 PM
  2. FM sound coming from tuner card not sound card
    By Ascension in forum Newbie
    Replies: 2
    Last Post: 07-18-2005, 04:24 AM
  3. Wireless card powered up when computer is off?
    By PatO in forum General Hardware Discussion
    Replies: 5
    Last Post: 03-08-2005, 07:54 PM
  4. 802.11g Wireless PCI Card - $25 Shipped
    By hd54321 in forum Classified Archive
    Replies: 16
    Last Post: 11-07-2004, 09:04 AM
  5. help - video card problems
    By Cliff in forum General Hardware Discussion
    Replies: 4
    Last Post: 04-15-2002, 05:25 PM

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
  •