• 0

[VB.NET] Setting Internet Explorer Proxy Settings


Question

I have this plugin-based application where one of the plugins, it's supposed to change IE proxy settings. I'm doing this via registry, and all the values are changed according to the real settings. The keys/values I changed are the ones that IE changes when you enable/disable the proxy server as I took screenshots of both the registry states, before and after applying a proxy server.

However, this is not really working. As I said, the values change (to enable or disable depending on what we want) but the checkbox on Internet Explorer settings doesn't change. Well, if the proxy is really enabled and I want to disable it, it works, the checkbox is unmarked, but if the checkbox is not marked and I try to enable it with my code, all values change but the checkbox remains unchecked.

Here's the code:

Public Sub EnableProxy()
		If objHost.DirectConnection = False Then
			Dim regKey As RegistryKey

			regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)

			regKey.SetValue("ProxyEnable", True, RegistryValueKind.DWord)
			regKey.SetValue("ProxyServer", objHost.ProxyAddress.ToString + ":" + objHost.ProxyPort.ToString, RegistryValueKind.String)

			If objHost.BypassLocal Then
				regKey.SetValue("ProxyOverride", "<local>", RegistryValueKind.String)
			Else
				regKey.DeleteValue("ProxyOverride", False)
			End If

			regKey.Close()
		Else
			MessageBox.Show("Networkcher is currently not configured to use a proxy server. " + ControlChars.CrLf + _
							"Please open Network Switcher settings dialog and configure the proxy server.", "Missing proxy settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
		End If
	End Sub

	Public Sub DisableProxy()
		Dim regKey As RegistryKey

		regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)

		regKey.SetValue("ProxyEnable", False, RegistryValueKind.DWord)

		regKey.Close()
	End Sub

I would really appreciate any help on this...

3 answers to this question

Recommended Posts

  • 0
  Nazgulled said:
I have this plugin-based application where one of the plugins, it's supposed to change IE proxy settings. I'm doing this via registry, and all the values are changed according to the real settings. The keys/values I changed are the ones that IE changes when you enable/disable the proxy server as I took screenshots of both the registry states, before and after applying a proxy server.

However, this is not really working. As I said, the values change (to enable or disable depending on what we want) but the checkbox on Internet Explorer settings doesn't change. Well, if the proxy is really enabled and I want to disable it, it works, the checkbox is unmarked, but if the checkbox is not marked and I try to enable it with my code, all values change but the checkbox remains unchecked.

Here's the code:

Public Sub EnableProxy()
		If objHost.DirectConnection = False Then
			Dim regKey As RegistryKey

			regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)

			regKey.SetValue("ProxyEnable", True, RegistryValueKind.DWord)
			regKey.SetValue("ProxyServer", objHost.ProxyAddress.ToString + ":" + objHost.ProxyPort.ToString, RegistryValueKind.String)

			If objHost.BypassLocal Then
				regKey.SetValue("ProxyOverride", "<local>", RegistryValueKind.String)
			Else
				regKey.DeleteValue("ProxyOverride", False)
			End If

			regKey.Close()
		Else
			MessageBox.Show("Networkcher is currently not configured to use a proxy server. " + ControlChars.CrLf + _
							"Please open Network Switcher settings dialog and configure the proxy server.", "Missing proxy settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
		End If
	End Sub

	Public Sub DisableProxy()
		Dim regKey As RegistryKey

		regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)

		regKey.SetValue("ProxyEnable", False, RegistryValueKind.DWord)

		regKey.Close()
	End Sub

I would really appreciate any help on this...

Are you restarting internet explorer before checking for the check box?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • every time.... why can't I install windows 11 on my 8088?
    • No word on how much of an ewaste apocalypse this will cause.
    • The list of Mac devices rumored to get macOS 26 by Hamid Ganji Apple will announce macOS 26 or macOS Tahoe at its Monday Worldwide Developers Conference. As has been reported multiple times over the past weeks, all Apple operating systems will receive a UI overhaul, a touch of AI, and new names at this year's WWDC. The logic behind the "26" in the new macOS version is that Apple aims to align its naming schedule with its 2025-2026 release cycle. The same version number will also appear across iOS, iPadOS, watchOS, and tvOS. While skipping multiple software versions raises many questions, it might help maintain consistency in the Apple ecosystem. With just two days away from the WWDC kick-off, many Mac owners might wonder if the upcoming macOS 26 is compatible with their devices. Here's the rumored list of compatible Mac devices with the macOS 26: MacBook Air (M1 and later) MacBook Pro (2019 and later) iMac (2020 and later) Mac Mini (M1 and later) Mac Studio (all models) Mac Pro (2019 and later) This report comes from MacRumors, which cites a private account on X as the source. However, the interesting thing about this list is that, according to the leaker, Apple might end software support for the MacBook Pro 13-inch (2020 model, two Thunderbolt 3 ports). For now, we should take this claim with a pinch of salt. The 2020 MacBook Pro 13-inch launched with both Intel and Apple Silicon M1 processors. It also comes with two port configurations. Apple is expected to end support for more Intel-based Mac devices this year, and this specific MacBook Pro variant might also be on Apple's kill list. WWDC 2025 kicks off on June 9, and Apple will unveil the latest version of its operating systems with an overhauled UI and a slew of AI-related features. So far, we know what Apple Watch models might get watchOS 26. Apple will announce the compatibility list of various devices at Monday's event.
    • It's a separate question to the thread, but I have VLC and qBitorrent working on W11 without any issue. Download->install->job done.
    • Currently I am using Display Port connection to monitor.   If I change the setting you show above it does make text larger, but ALL text larger not just icon text on desktop. Also is doesn't change the text weight at all. That setting leaves it very thing test. I want bold, or semibold.
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      490
    2. 2
      +FloatingFatMan
      258
    3. 3
      snowy owl
      249
    4. 4
      ATLien_0
      223
    5. 5
      +Edouard
      190
  • Tell a friend

    Love Neowin? Tell a friend!