Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2006, 11:29 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Howto retrieve MAC Address of Wireless Connections

I have been struggling to get a program working in Visual Basic 2005 that gets the MAC addresses of all of the wifi connections and then puts them in a list box. The code looks like this:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim query As String = "SELECT * FROM MSNDis_80211_BSSIList WHERE Active='True'"

Dim searcher As Management.ManagementObjectSearcher = New Management.ManagementObjectSearcher("root/WMI", query)

Dim moc As Management.ManagementObjectCollection = searcher.Get()

Dim moe As Management.ManagementObjectCollection.ManagementOb jectEnumerator =

moc.GetEnumerator()

moe.MoveNext()

Dim objarr() As Management.ManagementBaseObject = CType(moe.Current.Properties("Ndis80211BSSIList"). Value,

Management.ManagementBaseObject())

For Each obj As Management.ManagementBaseObject In objarr

Dim ssid() As Char = System.Text.Encoding.ASCII.GetChars(CType(obj("Ndi s80211MacAddress"), Byte()))

ListBox1.Items.Add(New String(ssid))

Next

End Sub

End Class

Sorry about the word wrap, but anyway, when I run the program, it doesn't show to addresses in the listbox. For each wireless connection, it just show a blank line.

So I was wondering what's wrong with this code. And, if this method isn't possible, is their any way to retrieve the MAC addresses in Visual Basic 2005?

Thanks for any help.

P.S. Sorry if this belongs in the Visual Basic beginner's forum. I wasn't sure where to put it.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Client's MAC Address! mutinousguy ASP.NET 2.0 Professional 0 September 27th, 2007 07:42 PM
How to get MAC K Address msbsam ASP.NET 2.0 Basics 2 July 10th, 2007 06:36 AM
how to find mac address of my client...? abdusalam VB How-To 2 June 14th, 2006 04:02 AM
Getting the MAC Address mswombat Classic ASP Basics 0 June 3rd, 2006 11:45 AM
how to find mac address of my client...? abdusalam Pro VB.NET 2002/2003 1 August 3rd, 2004 03:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.