• 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

    • So is Ubuntu and Fedora (with GNOME). It's a welcome move and those that need X11 can easily install as pointed out in the article it but that won't stop a loud minority from whining of course. Funny but It will actually be easier to install X11 on Ubuntu then enable Flatpak support/Flathub and use them.
    • End of an era? Kubuntu is removing default support for X11 in new installs by David Uzondu X11, the old window system whose days have long felt numbered, just saw another one of its major supporters head for the exit. Kubuntu has decided to follow its parent distro's lead, making its next release, version 25.10, a Wayland-only affair for fresh installs. It seems many Linux developers see Wayland as the future. Just recently, Linux Mint started working to improve support for the protocol in Cinnamon, tackling lingering issues with keyboard layouts and input methods. You can even see the progress in KDE's development, where an upgrade to Wayland PiP is planned for KDE Plasma 6.5. So what's the logic behind dropping a session that, for the most part, still works? According to Kubuntu's Rik Mills, the team wants to "rip off this sticking plaster" now, in an interim release, rather than ###### off a lot of people by doing it in the next Long-Term Support version, 26.04. The developers feel that maintaining code for the aging X11 system holds back progress on security and new features that Wayland can enable more easily. Plus, supporting two separate display servers is a massive undertaking. Of course, this change might have some people worried, but relax; all is not lost if you still need the old session. If you're running hardware that acts up, like some older NVIDIA cards, or who relies on an ancient application that doesn't play nicely with the XWayland compatibility layer, you can still get your familiar session back. Just enter the following command in your terminal: sudo apt install plasma-session-x11 Once that command finishes, the X11 session will appear as an option on the login screen, so you can carry on as before. As OMGUbuntu notes, not everyone in the Ubuntu family is following its lead just yet. Other official flavors like Xubuntu, Ubuntu Budgie, and Ubuntu Cinnamon are expected to keep offering an X11 session on their default installs for this cycle.
    • Mangohud hasn't been built into "Steam Deck", it has been built into SteamOS. I understand that your goal is to try and praise MS for a simple feature that everyone else has, but we are comparing OS vs OS. Hardware does not have anything "built-in". Software does. Like it or not, SteamOS has it "built-in". And it is far superior to XBOX game bar's information.
    • Please don't inject yourself into a discussion you did not read or understand what was said. No where did I say Windows was hard to use. I knew when seen two notifications with your handle the replies they were going to be a waste of time to read.
    • Exactly. The UI feels a lot snappier when animations are disabled. I think I might actually give it a try for a while, I'm liking it so far.
  • Recent Achievements

    • First Post
      Johnny Mrkvička earned a badge
      First Post
    • Week One Done
      viraltui earned a badge
      Week One Done
    • One Month Later
      serfegyed earned a badge
      One Month Later
    • Dedicated
      firey earned a badge
      Dedicated
    • Dedicated
      fettermanj earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      644
    2. 2
      Michael Scrip
      221
    3. 3
      ATLien_0
      218
    4. 4
      Steven P.
      143
    5. 5
      +FloatingFatMan
      142
  • Tell a friend

    Love Neowin? Tell a friend!