Re: VB INTERNET CONTROLS OCX
Try this:
'In a Module..
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
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
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
Re: VB INTERNET CONTROLS OCX
Thanks for the good registry method.
Could you give the codes necessary to use Declare INCLUDE LIB method to use WinInet.Dll in VB??