Here's another of those 'my veriest firstest MASM program' rants. I thought I'd be totally original and be only the 5 millionth netizen to create an internet online timer.
It has a rather minimalist output, but it shows what I want it to: hh:mm:ss logged on for this session/day/month and #connections this month. The former gives me some idea of how much I'm going to be over this month's 50 hour limit and the latter gives me some idea of how big my phone bill is going to be. My ISP, possibly aided by Telstra, Australia's monopoly telco which has a vested interest in this as well, has the nasty habit of occasionally disconnecting me 30 seconds after I log on. It could be accidental but happens often enough to make me suspicious.
The program polls InternetGetConnectedState once a second. If a connection is detected it adds 1 to the #seconds for this session/day/month and displays the newimproved times. If it was previously disconnected it restores itself, if a disconnect is detected it minimises itself to the system tray (a mouse-click, left or right, will restore). Either on disconnect or on shutdown it writes current data to disk (reads it on program startup) in order to detect when we reach either a new day, in which case the day's total is reset, or the end of the month, in which case everything is reset. The #connections counter is incremented with each connection detected and reset at the end of the month. I worked on the assumption that I wouldn't be online at midnight on the last day of the month.
If anyone notices that the icon looks slightly (very) like the Deutsche Telekom logo, it is partly accidental (shows how imaginative I am) and partly in recognition of Oleh, whose Ollydbg v1.04 got a real workout getting this thing working.

FFTF (feel free to flame).
Posted on 2001-12-10 03:39:30 by peterverstappen

Very nice program.

First it couldn't find .dat

Second time started happily and counted regardless
if I am connected or not.
Posted on 2001-12-10 04:34:48 by forge
Nice peterverstappen. You did a good job. However it does not work with my connection, i think it is due to i have "cable-modem" connection. The program always thinks that i am connected to internet. Anyways, i think that a few lines of modification will make it work better in my computer.

Good job peterverstappen :)
Posted on 2001-12-10 08:11:40 by CodeLover
As far as I know, you can only query the internet connected state
on connections using modem... or perhaps it's Dial-Up Networking
(which is also used in some DSL solutions).
Posted on 2001-12-10 09:25:39 by f0dder
Thanks for your feedback, I'm surprised anyone bothered to d/l it at all.
As a 'my first MASM prog' it wasn't meant to be all things to all people, it was just written for, and tested on, my Gateway Celeron 700 with a dial-up to my ISP .
Posted on 2001-12-10 17:37:12 by peterverstappen