Discussion:
Network connect/disconnect events...?
(too old to reply)
arpie.b
2007-01-23 08:27:07 UTC
Permalink
OK, I've been digging around trying to find a good way to do this, and
have managed to find several half-baked ways of doing it - hoping
someone else has had better luck and can point me in the right direction...

I need to have my application be notified when a network connection
(wired OR wireless) is established or lost, and be able to discern which
network connection it was (wired - domain, wireless - SSID). So far I
have looked at WMI, SENS, NLA, WLAN API, and Winsock but none of these
implementations (or code samples I've seen) seem to do much more than
say "yep, you're connected!" or "uh-oh - no more network..." unless you
install tons of extra SDK/DDK/API/hotfixes/etc to the client system.

Does anyone know of a simple, small, event-driven way to:

1. Have an application be notified of a change in network connectivity...

2. Let the application know what type of network it was (wired vs
wireless)...

3. In the case of wired, provide a means of retrieving the domain that
was connected to (ideally also the domain that was disconnected from,
but not a requirement)...

4. In the case of wireless, provide a means of retrieving the SSID that
was connected to (ideally also the SSID that was disconnected from, but
not a requirement)...

5. AND use a minimal set of APIs that are native on Windows XP and don't
require 100MB of patches/downloads to get my 500KB VB or C++ app to run!

Thanks!

-R
Arkady Frenkel
2007-01-24 08:18:33 UTC
Permalink
You do can use WMI do check the state, look at
http://www.ndis.com/faq/QA01050301/default.htm.
To receive notification for such event you can use
ExecNotificationQuery(Async)(). As API you can use
GetIfEntry() to check the state or NotifyAddrChange() or NotifyRouteChange()
if MediaSense is on ( on by default ). For adapter's you can check with
AdapterType of Win32_NetworkAdapter ( WMI )
http://msdn2.microsoft.com/en-us/library/aa394216.aspx

Arkady
Post by arpie.b
OK, I've been digging around trying to find a good way to do this, and
have managed to find several half-baked ways of doing it - hoping someone
else has had better luck and can point me in the right direction...
I need to have my application be notified when a network connection (wired
OR wireless) is established or lost, and be able to discern which network
connection it was (wired - domain, wireless - SSID). So far I have looked
at WMI, SENS, NLA, WLAN API, and Winsock but none of these implementations
(or code samples I've seen) seem to do much more than say "yep, you're
connected!" or "uh-oh - no more network..." unless you install tons of
extra SDK/DDK/API/hotfixes/etc to the client system.
1. Have an application be notified of a change in network connectivity...
2. Let the application know what type of network it was (wired vs
wireless)...
3. In the case of wired, provide a means of retrieving the domain that was
connected to (ideally also the domain that was disconnected from, but not
a requirement)...
4. In the case of wireless, provide a means of retrieving the SSID that
was connected to (ideally also the SSID that was disconnected from, but
not a requirement)...
5. AND use a minimal set of APIs that are native on Windows XP and don't
require 100MB of patches/downloads to get my 500KB VB or C++ app to run!
Thanks!
-R
arpie.b
2007-01-26 01:42:32 UTC
Permalink
Thanks for the info. I'll take a crack at it using the references you
supplied. I'm especially interested in checking out the ActiveX event
object mentioned in the first page you provided a link for.

-R
Post by Arkady Frenkel
You do can use WMI do check the state, look at
http://www.ndis.com/faq/QA01050301/default.htm.
To receive notification for such event you can use
ExecNotificationQuery(Async)(). As API you can use
GetIfEntry() to check the state or NotifyAddrChange() or NotifyRouteChange()
if MediaSense is on ( on by default ). For adapter's you can check with
AdapterType of Win32_NetworkAdapter ( WMI )
http://msdn2.microsoft.com/en-us/library/aa394216.aspx
Arkady
Post by arpie.b
OK, I've been digging around trying to find a good way to do this, and
have managed to find several half-baked ways of doing it - hoping someone
else has had better luck and can point me in the right direction...
I need to have my application be notified when a network connection (wired
OR wireless) is established or lost, and be able to discern which network
connection it was (wired - domain, wireless - SSID). So far I have looked
at WMI, SENS, NLA, WLAN API, and Winsock but none of these implementations
(or code samples I've seen) seem to do much more than say "yep, you're
connected!" or "uh-oh - no more network..." unless you install tons of
extra SDK/DDK/API/hotfixes/etc to the client system.
1. Have an application be notified of a change in network connectivity...
2. Let the application know what type of network it was (wired vs
wireless)...
3. In the case of wired, provide a means of retrieving the domain that was
connected to (ideally also the domain that was disconnected from, but not
a requirement)...
4. In the case of wireless, provide a means of retrieving the SSID that
was connected to (ideally also the SSID that was disconnected from, but
not a requirement)...
5. AND use a minimal set of APIs that are native on Windows XP and don't
require 100MB of patches/downloads to get my 500KB VB or C++ app to run!
Thanks!
-R
Loading...