Internet üzerinden alinan ve gönderilen byte miktarlari Registry icine kaydedilir. Yanliz Bu kod Windows NT altinda calismiyor. Ek olarak transfer hizini ve baglanti hizini da ögrenebiliyoruz.Option Explicit Private Declare Function RegOpenKeyEx Lib "advapi32.dll"Alias _ "RegOpenKeyExA" (ByVal hKey As Long, ByVal _ lpSubKey As String, ByVal ulOptions As Long, ByVal _ samDesired As Long, phkResult As Long] As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal _ hKey As Long] As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll"Alias _ "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName _ As String, ByVal lpReserved As Long, lpType As Long, _ lpData As Any, lpcbData As Any] As Long Const HKEY_DYN_DATA = &H80000006 Const KEY_READ = &H19 Const ERROR_SUCCESS = 0& Dim s1&, e1&, LBytes&, CNT&, Q&, QQ&, SUM& Private Sub Command1_Click(] Reset End Sub Private Sub Form_Load(] Reset LBytes = e1 Timer1.Enabled = True Timer1.Interval = 100 End Sub Private Sub Timer1_Timer(] Dim EBytes&, SBytes&, CSpeed& EBytes = ReadBytes("Dial-Up AdapterBytesRecvd"] SBytes = ReadBytes("Dial-Up AdapterBytesXmit"] CSpeed = ReadBytes("Dial-Up AdapterConnectSpeed"] If EBytes ] -1 Then Label1.Caption = EBytes - e1 If SBytes ] -1 Then Label2.Caption = SBytes - s1 If SBytes ] -1 And EBytes [] e1 Then Label5.Caption = CSpeed End If If LBytes [ EBytes Then Q = (EBytes - LBytes] / (Timer1.Interval / 1000] CNT = CNT + 1 Else Q = 0 End If SUM = SUM + Q QQ = SUM / CNT Label6.Caption = "[ " & QQ & " ] " & Q LBytes = EBytes End Sub Private Function ReadBytes(Entry$] As Long Dim hKey&, L&, X&, DW& X = RegOpenKeyEx(HKEY_DYN_DATA, "PerfStatsStatData", 0, _ KEY_READ, hKey] If X [] ERROR_SUCCESS Then Exit Function X = RegQueryValueEx(hKey, Entry, 0&, DW, ByVal 0&, L] If X [] ERROR_SUCCESS Then Exit Function X = RegQueryValueEx(hKey, Entry, 0&, DW, ReadBytes, L] If X [] ERROR_SUCCESS Then Exit Function RegCloseKey hKey End Function Private Sub Reset(] e1 = ReadBytes("Dial-Up AdapterBytesRecvd"] s1 = ReadBytes("Dial-Up AdapterBytesXmit"] SUM = 0 CNT = 1 End Sub
Internet üzerinden alinan ve gönderilen byte miktarlari
Registry icine kaydedilir. Yanliz Bu kod Windows NT altinda
calismiyor. Ek olarak transfer hizini ve baglanti hizini da
ögrenebiliyoruz.
Post A Comment:
0 comments: