Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- Local $objWMIService = ObjGet("winmgmts:\\localhost\root\cimv2")
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- ; window
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- Local $iGUIWidth = 150, $iGUIHeight = 13
- Local $iRecBytes = 0, $iSenBytes = 0, $aItems
- Local $hGUI = GUICreate("bps", $iGUIWidth, $iGUIHeight, (@DesktopWidth / 2) - ($iGUIWidth / 2), 1, _
- $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
- Local $idLabel = GUICtrlCreateLabel(" ", 0, 0, $iGUIWidth, $iGUIHeight, BitOR($SS_CENTER, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG)
- GUISetState()
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- ; main loop
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- While 1
- get_bytes()
- GUICtrlSetData($idLabel, "Down:"&Round($iRecBytes / 1024) & "Kbps Up:" & Round($iSenBytes / 1024) & "Kbps")
- Sleep(1000)
- WEnd
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- ; get bytes
- ;- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- Func get_bytes()
- $aItems = $objWMIService.ExecQuery("SELECT BytesReceivedPersec,BytesSentPersec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface", "WQL", 0x10 + 0x20)
- For $objItem In $aItems
- $iRecBytes = $objItem.BytesReceivedPersec
- $iSenBytes = $objItem.BytesSentPersec
- ExitLoop
- Next
- EndFunc ;==>get_bytes
Advertisement
Add Comment
Please, Sign In to add comment