بسم الله الرحمن الرحيم
السلام عليكم
هذا جزء من برنامج يقوم بفتح عداد الانترنت عند أتصال جهاز الكمبيوتر
بشبكة الانترنت،ما التغيير الذي يجب ان أعمله حتى يتلائم هذا البرنامج مع نظام اكس بي
أو حتى يستطيع أن يقرأ قيمة الريجيستري لانه عند تنفيده دائما لا يستطيع أيجاد قيمة الريجيستري...
أرجو ان تفيدوني
وجزأكم الله خيرا"....
هذا هو البرنامج
Option Explicit Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult 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 Long) As Long ' Note that if you declare the lpData parameter as string, you must pass it By Value. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_LOCAL_MACHINE = &H80000002 Private FoundConnection As Boolean Public Function IsConnected() As Boolean Dim lRegKey As Long Dim bData(3) As Byte If RegOpenKey(HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\RemoteAccess", lRegKey) = 0 Then 'Opened RegKey Successfully.. If RegQueryValueEx(lRegKey, "Remote Connection", 0&, 1&, bData(0), 4) = 0 Then 'Query the Value of "Remote Connection" 1 - Connected, 0 - Not Connected IsConnected = bData(0) Else 'Counldn't find the Value, assume no Connection IsConnected = False End If 'Close the Registry Key Call RegCloseKey(lRegKey) End If End Function Private Sub Form_Load() FoundConnection = 0 Timer1.Enabled = True Timer1.Interval = 1000 End Sub Private Sub Timer1_Timer() Timer1.Enabled = False If IsConnected() And FoundConnection = 0 Then FoundConnection = 1 Form2.Show End If Timer1.Enabled = True End Sub
