A Tiny Meter + Animated Tray Icon Class
A Tiny Meter + Animated Tray Icon Class
So many netmeters, none I like. I want to see what's going on with super fast refresh, but little or no CPU load. I don't care what happened 5 minutes ago, just gimme a current average speed and a byte counter. I want meaningful indications for low and high traffic. I want a sizeable window.
So its a logarithmic scale bar graph... all buffered GDI in a sizable dialog. I've only completed the top graph (downloads)... the bottom will be the same for uploads. I also plan to add tickeys for peak speed and for disk freespace. The scale can be over any range, but it's currently set by constants in the .bi file.
http://calstover.com/snews/freebasic/atinymeter/
(updated link 16-Oct-07)
compile (I'm using 0.18 beta dated June 30):
fbc -s gui netmeter3.bas netmeter3.rc
Then fire it up and go download something. Click the bmp to change adapters (if you have more than 1 enabled) and to rezero the counter. Does it work with dialup adapters? How hilarious/ignorant is my code? What would you change? Finally, can someone explain how can I insert at the beginning of an array without moving every item down one at a time? I've GOTTA be doing that wrong. (see line 495)
So its a logarithmic scale bar graph... all buffered GDI in a sizable dialog. I've only completed the top graph (downloads)... the bottom will be the same for uploads. I also plan to add tickeys for peak speed and for disk freespace. The scale can be over any range, but it's currently set by constants in the .bi file.
http://calstover.com/snews/freebasic/atinymeter/
(updated link 16-Oct-07)
compile (I'm using 0.18 beta dated June 30):
fbc -s gui netmeter3.bas netmeter3.rc
Then fire it up and go download something. Click the bmp to change adapters (if you have more than 1 enabled) and to rezero the counter. Does it work with dialup adapters? How hilarious/ignorant is my code? What would you change? Finally, can someone explain how can I insert at the beginning of an array without moving every item down one at a time? I've GOTTA be doing that wrong. (see line 495)
Last edited by calstover on Dec 25, 2007 3:33, edited 2 times in total.
You could try this to insert at the beginning of the array...
Code: Select all
Sub NetMeterStats.AddData (uiBC As UInteger, dbTS As Double)
Dim Temp(1 To NDP_MAX) As NTMTR_DATA_PT
If (uiBC = 0) Then Exit Sub
MoveMemory @Temp(2), @DataPts(1), SizeOf(NTMTR_DATA_PT) * (NDP_MAX-1)
Temp(1).uiBytCnt = uiBC
Temp(1).dbTimStp = dbTS
MoveMemory @DataPts(1), @Temp(1), SizeOf(NTMTR_DATA_PT) * (NDP_MAX)
If StartTm = -1 Then ReZeroCtr()
End Sub
Thanks for that; it was just what I had in mind and had no idea how to implement... later I will build up a proper circular array object.vdecampo wrote:You could try this to insert at the beginning of the array...
Another plea for help:
I'm using a dialog and GDI simply because I can't find a way to implement a standard freebasic window while properly handling the resizing and size limiting like I've done here. If I can, I'll switch before going too much further. Anybody have examples or pointers?
new version
I've fleshed it out some, renamed it A Tiny Meter, and posted it at my site.
http://calstover.com/snews/freebasic/atinymeter/
http://calstover.com/snews/freebasic/atinymeter/
Cool proggy. :)
I downloaded the program from your website, but I had to rename it to an .exe ?
Anyway, after that it worked.... but I had no idea what it was doing... until I reviewed the web page.
My advice would be to label the program itself, so that the user has immediate visual feedback as to what is what. Just label it as you have the web site diagram.
I downloaded the program from your website, but I had to rename it to an .exe ?
Anyway, after that it worked.... but I had no idea what it was doing... until I reviewed the web page.
My advice would be to label the program itself, so that the user has immediate visual feedback as to what is what. Just label it as you have the web site diagram.
Are you using dialup? I know the adapter checking is not very robust!Kot wrote:I don't know what's wrong, but it doesn't work on my computer, it eats all the processor time and doesn't even show. It's visible only in Windows Task Manager when I must kill the process because there is no other way to turn it off. WindowsXP, Avira Antivir Personal Edition, PCTools Firewall Plus.
I want to, but it's not within my skill level. Yet. How is CPU usage for you? Ima add a speed setting anyway, but I'm curious.axipher wrote:Windows XP Pro SP1 Zonealarm, AVG, Spybot
Works beautiful, nice and clean too, Zonealarm didn't even ask me to allow it or anything which is nice, possibility of minimize to tray?
Yeah posting an exe is probably a bad idea... I should at least zip it.Voltage wrote:Cool proggy. :)
I downloaded the program from your website, but I had to rename it to an .exe ?
Anyway, after that it worked.... but I had no idea what it was doing... until I reviewed the web page.
My advice would be to label the program itself, so that the user has immediate visual feedback as to what is what. Just label it as you have the web site diagram.
I'm fighting the labeling vs cleaniliness issue. I'll add them and another switch to turn 'em off. They're not needed once you know what you're looking at.
How is the text? Should the overall size be smaller?
Now with animated tray icon goodness
I've created a simple trayicon class, fbTrayIcon, which provides a DC you can draw on with GDI. The gizmo converts your drawing into an Icon and sends it to the system tray. (see fbtrayicon.bi)
It also sends a message to the parent window (you supply it's handle to the constructor) when mouse activity occurs on the tray icon. To see how this works, check lines 59-69 in a_tiny_meter.bas
I've wrapped that into another class, specialized for A Tiny Meter, atm_fbTrayIcon. This type simply takes two integers 0-32 and draws little progress bars on the tray icon. To make your own animated icon, you should modify this file. (see atm_fbtrayicon.bi)
You'll find these files in source code link on the project's web site:
http://calstover.com/snews/freebasic/atinymeter/
I also fixed some resource leaks. They were due to resources created before testing to see if the routine should exit. Seems fantastic now but took forever to figure out ;-)
It also sends a message to the parent window (you supply it's handle to the constructor) when mouse activity occurs on the tray icon. To see how this works, check lines 59-69 in a_tiny_meter.bas
I've wrapped that into another class, specialized for A Tiny Meter, atm_fbTrayIcon. This type simply takes two integers 0-32 and draws little progress bars on the tray icon. To make your own animated icon, you should modify this file. (see atm_fbtrayicon.bi)
You'll find these files in source code link on the project's web site:
http://calstover.com/snews/freebasic/atinymeter/
I also fixed some resource leaks. They were due to resources created before testing to see if the routine should exit. Seems fantastic now but took forever to figure out ;-)