|
-
Jun 3rd, 2008, 05:09 AM
#1
Thread Starter
New Member
IsNetworkAlive function
Hello,
I'm writing a small app for a windows cd 5.0 device in .net 2005. This will be connected via Wifi.
I am trying to determine when the device is connected to the network. The IsNetworkAlive api call works fine on a Windows 2000/xp pc (example follows)
Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long) As Long
Const NETWORK_ALIVE_AOL = &H4
Const NETWORK_ALIVE_LAN = &H1
Const NETWORK_ALIVE_WAN = &H2
Dim Ret As Long
If IsNetworkAlive(Ret) = 0 Then
MsgBox "The local system is not connected to a network!"
Else
MsgBox "The local system is connected to a " + IIf(Ret = NETWORK_ALIVE_AOL, "AOL", _
IIf(Ret = NETWORK_ALIVE_LAN, "LAN", "WAN")) + " network!"
End If
Is it possible to do this on Windows CE?
Thank you.
-
Jun 3rd, 2008, 05:28 AM
#2
Re: IsNetworkAlive function
Hi.
Why don't u use system.Net.Dns.GetHostName ?
Or you can use inthehand classes http://inthehand.com/
or you can construct your own API with and dll it for pocket pc
Last edited by sapator; Jun 3rd, 2008 at 05:35 AM.
-
Jun 3rd, 2008, 05:40 AM
#3
Thread Starter
New Member
Re: IsNetworkAlive function
Good question.
I try it.
Teo
-
Jun 3rd, 2008, 06:22 AM
#4
Frenzied Member
Re: IsNetworkAlive function
Take a look here - excellent video on how to handle it
-
Jun 3rd, 2008, 07:22 AM
#5
Re: IsNetworkAlive function
Ok i have made a post on codebank that will try to simulate The IsNetworkAlive api. It gives info on the adapter and if it is connected.
Just use my link in the signature.
Last edited by sapator; Jun 3rd, 2008 at 08:09 AM.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jun 3rd, 2008, 05:12 PM
#6
Re: IsNetworkAlive function
Never mind,
Just read that you are using Windows CE, suggested something for Windows Mobile.
-
Jun 14th, 2008, 08:54 PM
#7
Frenzied Member
Re: IsNetworkAlive function
Hello,
There is the SNAPI that has a classes called WIFIConnected, WIFIconnecting, and WIFIAvailable.
I think this is all you need.
Hope this helps,
Steve
-
Jun 15th, 2008, 12:31 AM
#8
Re: IsNetworkAlive function
This is what I was going to suggest, but I thought that was only for Windows Mobile, not for Windows CE.
Can you confirm?
Thanks,
Gary
-
Jun 17th, 2008, 01:47 AM
#9
Thread Starter
New Member
Re: IsNetworkAlive function
Hello,
Thanks for the suggestions and sorry for the late reply.
Everything works fine on windows mobile but on CE it doesn't work as expected.
First of all SNAPI WIFIConnected, WIFIconnecting, and WIFIAvailable are not supported on CE. I used the OpenNETCF and the example found here
http://msdn.microsoft.com/en-us/library/aa446491.aspx
I tried the system.Net.Dns.GetHostName. I tried it when the device was in range and had connection and a network address and without.
In both cases it takes very long to reply. About 35 seconds.
The same result was when I tried intheHand component. It takes over 30 seconds to reply. I used the ping.send command. You can set the timeout parameter also.
I tried intheHand component on a Windows mobile device. It works excellent.
I think i've tried everything on the CE but i get the same result every time. It takes over 30 seconds to reply.
I've installed compact framework sp2 also.
Any idea would be appreciated.
Thank you.
Teo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|