Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDetermine whether the system has Internet Explorer configured to use a proxy in Visual Basic 6
DescriptionThis example shows how to determine whether the system has Internet Explorer configured to use a proxy in Visual Basic 6.
Keywordsproxy, IE, Internet Explorer, Registry, key
CategoriesInternet, Tips and Tricks, VB.NET
 
Internet Explorer lets you specify proxy settings. In the Tools menu, select Internet Options. Select the Connections tab and click the LAN Settings button. The goal is to figure out if the box indicated by the arrow in the picture is checked.

Function GetRegKeyDWordValue opens a Registry key and reads a DWORD value from it.

The code uses RegOpenKeyEx to open the Registry key. It uses RegQueryValueEx to get the type and length of the desired subkey value and confirms that its type is DWORD. The code then calls RegQueryValueEx to get the value.

 
' 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
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated