467,915 Members | 1,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

How to Detect Network Connection

Al
Hi,
Is there any way to detected if a device is connected? How would I query to
see the device is connected to network. My application is mobile and mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al

Nov 21 '05 #1
  • viewed: 8872
Share:
5 Replies
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al


Nov 21 '05 #2
Al
Thank you so much

"scorpion53061" wrote:
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al


Nov 21 '05 #3
You might want to strip out that:
On Error Resume Next statement though. Ouch.

Steve

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp
Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp
"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al

Nov 21 '05 #4
Kelly,

Thanks,

Cor
Nov 21 '05 #5
LOL

I forgot my perfection pills today.

"Steve Long" <St**********@NoSpam.com> wrote in message
news:#B**************@TK2MSFTNGP15.phx.gbl:
You might want to strip out that:
On Error Resume Next statement though. Ouch.

Steve

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR


http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
win32_networkconnection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping


http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/northwindunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I
query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would
be
appreciated.
Regards
Al


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Alban Hertroys | last post: by
6 posts views Thread by Stephane Belzile | last post: by
reply views Thread by Giovanni | last post: by
5 posts views Thread by Morten | last post: by
4 posts views Thread by Frank Meng | last post: by
5 posts views Thread by Ke Tao | last post: by
1 post views Thread by =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post: by
3 posts views Thread by =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.