local area connection (1 Viewer)

janz

Registered User.
Local time
Today, 03:19
Joined
Jan 25, 2008
Messages
44
Hi All,

I'm trying to monitor my internet line. I can now successfully ping the line (see threat (shell function)and get the milli seconds back in my VBA program and hence in my Db. now the next challenge is that I would like to know how busy the line is at the ping instance. I tried to find a measurement inside my modem software but couldn't find one. So decided to switch to the next best thing and measure this PC. In the windows "task manager" there is a function called "local area connection" that value would do. I searched the forum and the net but couldn't find a solution how to get that value.

Can anybody please help and point me in the right direction?
pref. to measure the modem (all pc's on the network) or otherwise how to get the value from the task manager in my VBA program.

Ps. It's a pet project so no (real) budget.
 

Attachments

  • Taskmanager.gif
    Taskmanager.gif
    72.5 KB · Views: 103
Last edited:

janz

Registered User.
Local time
Today, 03:19
Joined
Jan 25, 2008
Messages
44
For all people interested this comes pretty close.

Code:
Function nw()

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_PerfFormattedData_Tcpip_NetworkInterface", , 48)
    ASENT = 0
    AREC = 0
For Each objItem In colItems

    'Debug.Print "-----------------------------------"
    'Debug.Print "BytesSentPersec: " & objItem.BytesSentPersec
    ASENT = ASENT + objItem.BytesSentPersec
    AREC = AREC + objItem.BytesReceivedPersec
Next
    If ASENT > 0 Or AREC > 0 Then
        Debug.Print "Bytes/Bits SentPersec: " & FormatNumber(ASENT, 0, , , vbTrue) & "/" & FormatNumber(ASENT * 8, 0, , , vbTrue)
        Debug.Print "Bytes/bits received: " & FormatNumber(AREC, 0, , , vbTrue) & "/" & FormatNumber(AREC * 8, 0, , , vbTrue)
    End If
    test = ASENT + AREC
End Function

It looks at all network adapters in the PC adds them together and gives the average value in a second. (I think)

Next challenge is to establish the processes that causes the transfers
 

Users who are viewing this thread

Top Bottom