Discussion:
Write a VB6 widget to disable/enable Local Area Connection?
(too old to reply)
MM
2013-11-01 10:34:06 UTC
Permalink
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.

How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget? (It's icon would change according to whether
the LAC was enabled or disabled.)

MM
MM
2013-11-01 10:36:59 UTC
Permalink
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget? (It's icon would change according to whether
the LAC was enabled or disabled.)
MM
Sorry, typo, should be "Its icon... etc"

MM
Deanna Earley
2013-11-01 10:43:10 UTC
Permalink
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget?
Look at the SetupAPI, which allows device enumeration and configuration,
possible also the NDIS API, but I'm not sure if that's just for driver side.

Also, a "widget"?
Post by MM
(It's icon would change according to whether the LAC was enabled or
disabled.)
You can't easily change the icon of a static shortcut without delving
into shell automation (or shell extensions).
If it was a system try/shell notification area icon, it could change its
icon, but needs to be running all the time.
--
Deanna Earley (***@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)
MM
2013-11-01 11:41:19 UTC
Permalink
On Fri, 01 Nov 2013 10:43:10 +0000, Deanna Earley
Post by Deanna Earley
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget?
Look at the SetupAPI, which allows device enumeration and configuration,
possible also the NDIS API, but I'm not sure if that's just for driver side.
Also, a "widget"?
Post by MM
(It's icon would change according to whether the LAC was enabled or
disabled.)
You can't easily change the icon of a static shortcut without delving
into shell automation (or shell extensions).
If it was a system try/shell notification area icon, it could change its
icon, but needs to be running all the time.
Yes, it would be, like my other widgets. I right-click on it and
enable or disable the LAC.

MM
Mayayana
2013-11-01 13:34:18 UTC
Permalink
| Yes, it would be, like my other widgets. I right-click on it and
| enable or disable the LAC.
|
What's wrong with the "widget" that's already
in the system tray? It allows you to right-click
for disable/enable, and the icon changes accordingly.
Just what you wanted. (You do realize you can have
one there if you want to? Check "Show icon in
notification area when connected". It doesn't work as
well on Vista/7, as the tray icons are poorly designed.
And on XP the "lighted monitors" that show network
activity are undependable in their operation. But I can't
think of a better, more expressive design than the dual
monitors indicator on XP.)
MM
2013-11-01 12:50:19 UTC
Permalink
On Fri, 1 Nov 2013 08:34:18 -0500, "Mayayana"
Post by Mayayana
| Yes, it would be, like my other widgets. I right-click on it and
| enable or disable the LAC.
|
What's wrong with the "widget" that's already
in the system tray?
What widget? I don't have a widget like that, on either PC, both
running XP.

MM
Mayayana
2013-11-01 14:51:32 UTC
Permalink
| >| Yes, it would be, like my other widgets. I right-click on it and
| >| enable or disable the LAC.
| >|
| > What's wrong with the "widget" that's already
| >in the system tray?
|
| What widget? I don't have a widget like that, on either PC, both
| running XP.
|

You snipped out my directions. Did you look in the Network
applet? If you open the Network Connections applet, then
right-click -> Properties on the relevant connection, you'll get
the window for managing the settings. Near the bottom is
a checkbox marked Check "Show icon in notification area when
connected". If you check that you'll get an icon in the system
tray that shows 2 tiny monitors. They glow light blue to indicate
activity. You can also right-click the icon to enable/disable the
connection. It's just what you were describing, and more.

I think that icon actually doesn't show by default, which
is rather bizarre. But there may be method to the madness:
In recent years, corporate software tends to go online without
asking and generally Microsoft doesn't want you keeping track
of that. (Your PC is now a service device.) In Vista/7 I don't
think the icon even shows activity.
Tim Rude
2013-11-01 14:08:29 UTC
Permalink
In Vista/7 I don't think the icon even shows activity.
Here's a very handy replacement for the system tray network icon in
Windows Vista/7/8. Shows the blinking activity. Plus it gives you easy
access to a lot of network settings when you right-click it.

http://www.itsamples.com/network-activity-indicator.html
MM
2013-11-01 14:35:02 UTC
Permalink
On Fri, 01 Nov 2013 09:08:29 -0500, Tim Rude
Post by Tim Rude
In Vista/7 I don't think the icon even shows activity.
Here's a very handy replacement for the system tray network icon in
Windows Vista/7/8. Shows the blinking activity. Plus it gives you easy
access to a lot of network settings when you right-click it.
http://www.itsamples.com/network-activity-indicator.html
Thanks, but I don't use any of those OS's except for brief testing.

MM
Mayayana
2013-11-01 16:18:45 UTC
Permalink
| > In Vista/7 I don't think the icon even shows activity.
| >
|
| Here's a very handy replacement for the system tray network icon in
| Windows Vista/7/8. Shows the blinking activity. Plus it gives you easy
| access to a lot of network settings when you right-click it.
|
| http://www.itsamples.com/network-activity-indicator.html
|

Very nice. Thanks. Vista/7 could turn out to
be a usable OS by the time it's EOL'ed. Not that
I expect that, but it seems possible. :)
MM
2013-11-01 14:32:58 UTC
Permalink
On Fri, 1 Nov 2013 09:51:32 -0500, "Mayayana"
Post by Mayayana
| >| Yes, it would be, like my other widgets. I right-click on it and
| >| enable or disable the LAC.
| >|
| > What's wrong with the "widget" that's already
| >in the system tray?
|
| What widget? I don't have a widget like that, on either PC, both
| running XP.
|
You snipped out my directions. Did you look in the Network
applet? If you open the Network Connections applet, then
right-click -> Properties on the relevant connection, you'll get
the window for managing the settings. Near the bottom is
a checkbox marked Check "Show icon in notification area when
connected". If you check that you'll get an icon in the system
tray that shows 2 tiny monitors. They glow light blue to indicate
activity. You can also right-click the icon to enable/disable the
connection. It's just what you were describing, and more.
I think that icon actually doesn't show by default, which
In recent years, corporate software tends to go online without
asking and generally Microsoft doesn't want you keeping track
of that. (Your PC is now a service device.) In Vista/7 I don't
think the icon even shows activity.
Well, fine. But when I disable LAC the widget disappears from the
systray! So it's pretty much useless, because to renable LAC I still
have to go through Control Panel/Network Connections etc. (I wonder
what idiot designed *that* widget!)

MM
Mayayana
2013-11-01 16:15:50 UTC
Permalink
| Well, fine. But when I disable LAC the widget disappears from the
| systray! So it's pretty much useless, because to renable LAC I still
| have to go through Control Panel/Network Connections etc. (I wonder
| what idiot designed *that* widget!)
|
I haven't seen that behavior. I see a red line
(or is it an X?) through the icon when it's disabled.
Henning
2013-11-01 17:46:04 UTC
Permalink
Post by Mayayana
| Well, fine. But when I disable LAC the widget disappears from the
| systray! So it's pretty much useless, because to renable LAC I still
| have to go through Control Panel/Network Connections etc. (I wonder
| what idiot designed *that* widget!)
|
I haven't seen that behavior. I see a red line
(or is it an X?) through the icon when it's disabled.
A small x in the low left corner.

/Henning
Henning
2013-11-01 17:47:16 UTC
Permalink
Post by Henning
Post by Mayayana
| Well, fine. But when I disable LAC the widget disappears from the
| systray! So it's pretty much useless, because to renable LAC I still
| have to go through Control Panel/Network Connections etc. (I wonder
| what idiot designed *that* widget!)
|
I haven't seen that behavior. I see a red line
(or is it an X?) through the icon when it's disabled.
A small x in the low left corner.
/Henning
I'll be damned... right it should say....

/Henning
Deanna Earley
2013-11-01 14:55:56 UTC
Permalink
You'll get an icon in the system tray that shows 2 tiny monitors.
They glow light blue to indicate activity. You can also right-click
the icon to enable/disable the connection. It's just what you were
describing, and more.
I think that icon actually doesn't show by default, which
I believe it was for performance reasons, as it was only updated by
polling (remember that it's a user mode application, not a
service/driver so doesn't have that state first hand).

Sadly, I can't find the original article I read about it now :(
In Vista/7 I don't think the icon even shows activity.
Vista is configurable, 7 is not (that I can see).
http://technet.microsoft.com/en-us/library/cc755225(v=ws.10).aspx
--
Deanna Earley (***@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)
Deanna Earley
2013-11-01 15:01:13 UTC
Permalink
Post by Deanna Earley
You'll get an icon in the system tray that shows 2 tiny monitors.
They glow light blue to indicate activity. You can also right-click
the icon to enable/disable the connection. It's just what you were
describing, and more.
I think that icon actually doesn't show by default, which
I believe it was for performance reasons, as it was only updated by
polling (remember that it's a user mode application, not a
service/driver so doesn't have that state first hand).
Sadly, I can't find the original article I read about it now :(
This explains the mechanism but not that it was removed (he didn't have
a time machine).
http://blogs.technet.com/b/markrussinovich/archive/2005/04/04/explorer-s-registry-polling.aspx
--
Deanna Earley (***@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)
MM
2013-11-01 17:06:35 UTC
Permalink
On Fri, 01 Nov 2013 14:55:56 +0000, Deanna Earley
Post by Deanna Earley
You'll get an icon in the system tray that shows 2 tiny monitors.
They glow light blue to indicate activity. You can also right-click
the icon to enable/disable the connection. It's just what you were
describing, and more.
I think that icon actually doesn't show by default, which
I believe it was for performance reasons, as it was only updated by
polling (remember that it's a user mode application, not a
service/driver so doesn't have that state first hand).
Sadly, I can't find the original article I read about it now :(
In Vista/7 I don't think the icon even shows activity.
Vista is configurable, 7 is not (that I can see).
http://technet.microsoft.com/en-us/library/cc755225(v=ws.10).aspx
What I've done is use the code snippet at
http://www.daniweb.com/software-development/visual-basic-4-5-6/threads/50255/network-lan-connection-to-be-enableddisabled

which works just how I want it.

Just in case that URL gets truncated, here it is in tinyurl format:
http://tinyurl.com/oa5ptng

MM
MM
2013-11-02 15:34:25 UTC
Permalink
Post by MM
On Fri, 01 Nov 2013 14:55:56 +0000, Deanna Earley
Post by Deanna Earley
You'll get an icon in the system tray that shows 2 tiny monitors.
They glow light blue to indicate activity. You can also right-click
the icon to enable/disable the connection. It's just what you were
describing, and more.
I think that icon actually doesn't show by default, which
I believe it was for performance reasons, as it was only updated by
polling (remember that it's a user mode application, not a
service/driver so doesn't have that state first hand).
Sadly, I can't find the original article I read about it now :(
In Vista/7 I don't think the icon even shows activity.
Vista is configurable, 7 is not (that I can see).
http://technet.microsoft.com/en-us/library/cc755225(v=ws.10).aspx
What I've done is use the code snippet at
http://www.daniweb.com/software-development/visual-basic-4-5-6/threads/50255/network-lan-connection-to-be-enableddisabled
which works just how I want it.
http://tinyurl.com/oa5ptng
MM
Just discovered that the PC remembers yesterday's setting! So if I
powered down with LAC disabled, it's still disabled when I switch on
the next day (or whenever). Not a problem; bit surprising though.

MM
Deanna Earley
2013-11-04 10:57:50 UTC
Permalink
Post by MM
Just discovered that the PC remembers yesterday's setting! So if I
powered down with LAC disabled, it's still disabled when I switch on
the next day (or whenever). Not a problem; bit surprising though.
I don't get why it's surprising, you're toggling a system setting.
There is nothing that says "Disable it just until I reboot" unless you
explicitly set it back to a known state on startup.
--
Deanna Earley (***@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)
Mayayana
2013-11-04 13:34:27 UTC
Permalink
| Just discovered that the PC remembers yesterday's setting! So if I
| powered down with LAC disabled, it's still disabled when I switch on
| the next day (or whenever). Not a problem; bit surprising though.
|

This seems to be only for you personally. You didn't
explain why, but for what it's worth: I like to keep
disconnected when not actually doing something online.
I use a firewall that can stop the myriad programs that
want to go online clandestinely. (The majority of newly
installed software now tries to "check for updates"
*before* installing or on first run, without asking.)
For thoroughness I like to just unplug. I have a UPS on
the desk that the network cable runs through. It's
very convenient to just pull the plug after going online,
or when installing new software.
MM
2013-11-04 18:05:49 UTC
Permalink
On Mon, 4 Nov 2013 08:34:27 -0500, "Mayayana"
Post by Mayayana
| Just discovered that the PC remembers yesterday's setting! So if I
| powered down with LAC disabled, it's still disabled when I switch on
| the next day (or whenever). Not a problem; bit surprising though.
|
This seems to be only for you personally. You didn't
explain why, but for what it's worth: I like to keep
disconnected when not actually doing something online.
I use a firewall that can stop the myriad programs that
want to go online clandestinely. (The majority of newly
installed software now tries to "check for updates"
*before* installing or on first run, without asking.)
For thoroughness I like to just unplug. I have a UPS on
the desk that the network cable runs through. It's
very convenient to just pull the plug after going online,
or when installing new software.
I do use ZoneAlarm on two other PCs, but the specific PC of which I
speak doesn't have ZoneAlarm and I don't want to install the latest
version, which, IMV, is pants.

I also pull the network cable on occasion, but it's a pain scrabbling
behind the PC or the D-Link switch, so I thought, what I need is the
one feature of ZA I use, namely the "Stop all internet activity"
feature, without going to all the bother of installing ZA itself.

MM
Mayayana
2013-11-04 22:37:09 UTC
Permalink
| I do use ZoneAlarm on two other PCs, but the specific PC of which I
| speak doesn't have ZoneAlarm and I don't want to install the latest
| version, which, IMV, is pants.
|

Ah, in that case, Online Armour v. 4.0.0.15 -- the last
free, unbloated version. (I think it was sold to another
company after that version.) I've forgotten what I've been
using for Win7, but for XP I always use OA. I spent some time
at one point investigating the various options and OA seemed
best. Nothing amazing, but it was well reviewed, relatively
small, and allows for detailed blocking without needing to
spend a lot of time fiddling with awkward settings.

I used ZA on Win98, but they reworked that later. It got
bloated, and they started building in defaults like letting
svchost through. So I dumped ZA on XP and had to find
something else.

For me, at least, if I also use a fixed IP for the router,
allowing me to disable DHCP, then I have no services or
Windows functions that need to leave the PC. That
means I can block svchost, system, etc., and only allow
the barebones: email, FTP, browsers accessing ports 53,
80, 443, etc.

My favorite all-time firewall was AtGuard for Win98. It
was a beautiful piece of work. One thing it had that's
missing from OA is that it would tell me not only what was
trying to get out but also where it was wanting to go.
Unfortunately, AtGuard was licensed to Symantec, which
then did their usual treatment: double the price, halve the
functionality, increase the marketing, and add a snazzy,
stunningly bloated GUI for the whole thing. Symantec's
AtGuard wrapper was a disaster, allowing some 700
named programs through by default.

Farnsworth
2013-11-01 16:00:51 UTC
Permalink
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget? (It's icon would change according to whether
the LAC was enabled or disabled.)
MM
For Vista+, there is an easy to use COM API to manage "Network Connections"
that is shown in the Control Panel:

Network List Manager:
http://msdn.microsoft.com/en-us/library/aa370803%28v=VS.85%29.aspx

For XP, one way that I didn't try is using the IP Helper function
SetIfEntry. You need to call GetNumberOfInterfaces() and GetIfEntry() to get
the correct adapter index, then call SetIfEntry() to enable/disable it.
Search the newsgroups or PSC for these functions just in case someone done
something similar before:

http://www.planet-source-code.com/
Farnsworth
2013-11-01 16:07:54 UTC
Permalink
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget? (It's icon would change according to whether
the LAC was enabled or disabled.)
MM
This VB6 sample gets you closer:

http://vbnet.mvps.org/code/network/getinterfacetable.htm
ObiWan
2013-11-02 09:46:50 UTC
Permalink
Post by MM
On XP if I go to Control Panel/Network Connections then right click on
Local Area Connection I can disable the connection temporarily. Or
click Enable to renable it.
How might I write a widget (API calls etc) to do this with VB6 simply
by clicking the widget? (It's icon would change according to whether
the LAC was enabled or disabled.)
use "netsh" ;-)
Loading...