Show Total bytes received in DesktopX

Hi there,
I'm using DekstopX and its awesome. Now I have Inbound and outbound traffic speed on my desktop, but can I also get the total amount downloaded?

Thanxs
3,152 views 8 replies
Reply #1 Top
I'm not surprised there've been no answers to this after doing a bit of research into it.

The short answer is yes - but anything is possible.

The longer answer is that it's quite a complex process and I haven't found a solution. Meters such as the inbound and outbound traffic ones rely on DesktopX's ability to tie in any of Windows's Performance counters (see Admin tools > Performance) into their graphics/text display plugin. The problem is that none of the default Performance counters give a running total of the amount up or downloaded.

The system is extensible via .dlls so the solution should be to find a third-party Performance counter .dll or to develop your own. I couldn't find any of the former and lack the knowledge (of C++) to develop anything. The Windows Resource Kit apparently has sample code available to write these Performance .dlls if anyone is interested.

I know this is much more info than you were looking for but I hoped this message might inspire greater coders than myself to have a think.

regards, Jerry



Powered by SkinBrowser!
Reply #2 Top
Well, I've tried out several ActiveX Controls that I used with VBScript implemented in desktopX but never got a satisfying result. Microsoft Win Sock Control has a bytes received property but it just gives me 0.
Why do they give the possibility to check the RAS bytes received but not the one for the regular internet or network traffic? I mean I can easily read it in the systemtray with one click. But that's one click too much.
I think I have to take out my C++ for dummies book out after all.
Reply #3 Top
I've been asking myself the same questions.

I also tried installing something called 'Network Monitor' that's meant to be an extra on the WinXP disk, but have no idea if it installed or not - there's certainly nothing new in the PDH listings.

ActiveX controls are completely beyond me at the moment. Sometimes I hanker back to the simplicity of assembler code.

regards, Jerry



Powered by SkinBrowser!
Reply #4 Top
There's a very interesting object in the DXSSupport Section. It's called: Tons of Information oabout your computer. Just search for 'tons'. Could give clues about how to proceed.
Reply #5 Top
what might be the easiest is to set up another object that displays the text set by the perf object which is set to incoming traffic. have that object save its value and change another object by adding its value to it every time it updates (which is I think persecond) so you have the original bytes per second object. another object that displays the bytes persecond and a third object which displays the total downloaded. Granted it probably won't be very accurate, but it should suffice until you or someone else figures out how to do it.
Reply #6 Top
I've made a bit of headway today. Here's something I've kludged together. Please read all the comments.

Pay particular regard to the two multipliers 32 and 1024, the raw data supplied by the WMI interface needs to be multiplied by these values to generate the total bytes received and sent. I think it's accurate tho am not 100% sure.

The problem is that these numbers are liable to be different on different systems, and I don't know how to find out what they are on a per system basis. I've looked all around but they just don't seem to exist. That's the task for us to crack.

regards, Jerry

Everything below here is the script:

' quick and dirty example to show how to display total bytes sent and received
' many thanks must go to [brazen weep] @ WC for his various pieces of code I've
' looked through, learnt from and re-edited into what I needed

' this code was developed by JerryHat @ WC with help from belsidaam @ WC
' in this form it's merely a technology demo that hardly does anything
' please don't copy it into a DX script edit window unless you know what
' you're doing. I don't see any way it could be harmful but I take no responsibility
' etc.

' that said, this code is freeware, take it, use it, don't bother to ask permission
' it would be nice to see the results tho

' to get it running you'll need to first find the proper InstanceName of your
' network adapter, mine is "NVIDIA nForce MCP Networking Controller"
' then create a new object in DX2.1, turn it into a text item in the states tab
' make a new script and copy and paste this script into it
' finally replace the InstanceName of my adapter with your own
' exit the edit script box and hit 'apply' on the properties dialog
' if all is well the bytes received and sent will display as your object
' hit 'apply' to force a refresh - sorry but I didn't have time to learn how
' to create a timer, as i said quick and dirty is the name of the game

' enjoy, JerryHat
' v0.1

Dim strComputer, objWMIService, total_string, total_obj

'Called when the script is executed
Sub Object_OnScriptEnter

total_string = ""

' get total bytes received and sent
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")

' get total received
Set total_obj = objWMIService.ExecQuery("SELECT * FROM MSNdis_CoReceivePdusOk")

For Each objItem In total_obj
If objItem.InstanceName = "NVIDIA nForce MCP Networking Controller" Then
total_string = objItem.NdisCoReceivePdusOk * 32 & " bytes received "
End If
Next

' get total sent
Set total_obj = objWMIService.ExecQuery("SELECT * FROM MSNdis_CoTransmitPdusOk")

For Each objItem In total_obj
If objItem.InstanceName = "NVIDIA nForce MCP Networking Controller" Then
total_string = total_string & objItem.NdisCoTransmitPdusOk * 1024 & " bytes sent"
End If
Next

' display as object text
Object.text = total_string

End Sub

'Called when the script is terminated
Sub Object_OnScriptExit

End Sub






Powered by SkinBrowser!
Reply #7 Top
Wow, that's a good job you've done. Jus transformed everything into mb.In my case, the received and sent values seem to be reversed. Very strange. But anyway, couldn't have done it better. For the timer, just create a timer in the on_scriptenter function: Object.SetTimer 6000, 1000 (name = 6000 and runs every 1000 milliseconds). Then create a sub object_ontimer6000 to define what's happening when the timer is supposed to do something. Just download the scriptguide from desktopx.net and you're done.

With that I can even know exactly what comes from my network and what comes from my modem (if internet doesn't come from the network)

Again, good work !
Reply #8 Top
The numbers are wrong and seem to change in an odd way - needs more attention.

Thanks for the info.

regards, Jerry



Powered by SkinBrowser!