Dialup check using Registry 
Author Message
 Dialup check using Registry

Hi

I know that when you do an dial upo connection (to an ISP...or whatever) a
parameteer is set in the registry under
KEY_LOCAL_MACHINE/SYSTEM/CURRENTCONTROLSET/SERVICES/REMOTEACCESS

with the value
REMOTE CONNECTION  = 01 00 00 00

How can i do an check from VB5 if this parameter is set. Any help would be
nice, and i wouldnt mind some sample code if someone has any.

/chris



Tue, 17 Oct 2000 03:00:00 GMT  
 Dialup check using Registry

To read the registry use the RegOpenKeyEx and RegQueryValueEx Api functions:

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

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

Declare Function RegCloseKey Lib "advapi32.dll" Alias "RegCloseKey" (ByVal
hKey As Long) As Long

Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_QUERY_VALUE = &H1

Example:

dim R&, hKey&, DataType&
R = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _
"SYSTEM\CURRENTCONTROLSET\SERVICES\REMOTEACCESS" _
0&, KEY_QUERY_VALUE, hKey)

If R = 0 then ' function succeeded
'Looks like your data is binary and 4 bytes long.(01 00 00 00)
dim Buffer(3) as byte
dim BufferLength&
BufferLength = len(Buffer)
R = RegQueryValueEx(hKey, "REMOTE CONNECTION ", 0&, DataType, _
Buffer(0), BufferLength)
R = RegCloseKey(hKey)
End if

'Examine Buffer...

Note you must be 100% accurate with the key and value names, the parameters
are not case-specific, though. The functions return 0 on success, and an
WinAPI error code otherwise.

Niels,

Quote:

>Hi

>I know that when you do an dial upo connection (to an ISP...or whatever) a
>parameteer is set in the registry under
>KEY_LOCAL_MACHINE/SYSTEM/CURRENTCONTROLSET/SERVICES/REMOTEACCESS

>with the value
>REMOTE CONNECTION  = 01 00 00 00

>How can i do an check from VB5 if this parameter is set. Any help would be
>nice, and i wouldnt mind some sample code if someone has any.

>/chris



Tue, 17 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Checking for dialup connection??

2. How: Detect Dialup-Connection with Dialup-Network?

3. enumerate registry entries using win32api registry functions

4. enum registry subkeys using winAPI32 registry functions

5. Using a dataset to check items in checked listbox

6. Using DCOM over a dialup connection

7. Dialup appears when using winsock control

8. End a dialup network session (pref Gracefully) using API

9. Dialup Networking using Visual Basic

10. VB6 using Dialup Networking??

11. Using the dialup from vbq

12. Check Registry

 

 
Powered by phpBB® Forum Software