Saturday, December 12, 2015

A little app for monitoring connectivity

One of the things that Windows Vista did better than the later releases was to recover network connectivity immediately when coming out of hibernation -- really, as if nothing had happened. Later releases seem to go back to square one to restart a WiFi connection -- and what is worse, there's no visual feedback from the systray icon after the initial handshake to tell when the link is actually useful.

As this can take tens of seconds, it is the biggest pain point I have with Windows X. So, finally I got around to writing a monitoring app.

I started with a simple systray application, and some sample code for using the Network Link Manager API as guidance for an F# application. I also needed to use the CoClass for instantiating an INetworkListManager in line 27 as noted here.

Then it was just a matter of adding some icons, for which I used stock images for blocked, warning and OK from the Visual Studio image library to indicate no connection, not yet usable connection and internet available. Finally StackOverflow reminded me about how to add an application icon, to make a shortcut look nicer.

So, without further ado


Later: having slept on it, there's this simplification can be made to the OnLoad method


Later still: when I've hibernated a laptop with this program running, both times now it has come back with the WiFi connection still live, just like it used to under Vista. Even better.