Title | Determine whether the system has Internet Explorer configured to use a proxy in Visual Basic 6 |
Description | This example shows how to determine whether the system has Internet Explorer configured to use a proxy in Visual Basic 6. |
Keywords | proxy, IE, Internet Explorer, Registry, key |
Categories | Internet, Tips and Tricks, VB.NET |
|
' Return a registry key value.
Private Function GetRegKeyDWordValue(ByVal root As Long, _
ByVal key_name As String, ByVal subkey_name As String) _
As Long
Dim hKey As Long
Dim value As Long
Dim length As Long
Dim value_type As Long
' Open the key.
If RegOpenKeyEx(root, key_name, _
0&, KEY_QUERY_VALUE, hKey) <> ERROR_SUCCESS _
Then
MsgBox "Error opening key."
Exit Function
End If
' Get the subkey's size.
If RegQueryValueEx(hKey, subkey_name, _
0&, value_type, ByVal 0&, length) _
<> ERROR_SUCCESS _
Then
MsgBox "Error getting subkey length."
End If
' Get the subkey's value.
If RegQueryValueEx(hKey, subkey_name, _
0&, value_type, ByVal value, length) _
<> ERROR_SUCCESS _
Then
MsgBox "Error getting subkey value."
ElseIf value_type <> REG_DWORD Then
MsgBox "Error getting subkey value. Subkey type is " & _
"" & value_type & " not DWORD"
Else
' Return the value.
GetRegKeyDWordValue = value
End If
' Close the key.
If RegCloseKey(hKey) <> ERROR_SUCCESS Then
MsgBox "Error closing key."
End If
End Function
|