Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. IE Proxy Switcher Deskband

IE Proxy Switcher Deskband

Scheduled Pinned Locked Moved C / C++ / MFC
toolshelpannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matthew Devine
    wrote on last edited by
    #1

    I am currently developing a little IE deskband that gives the user the ability to hotswap between proxy settings with the click of a button, the button then changes to the user knows what the current proxy setting is(Green Means Proxy On|Red Means Proxy off). The one problem I am running into is the fact that it is able to determine the proxy setting when I start IE and thus the button is correctly set, but if I manually change the proxy through IE via Tools -> Internet Options -> Connection Tab -> Lan Settings, the button doesn't update. I was wondering if there is anyway I could envoke a ilstener that would be able to notice when I manaully change the proxy and then set the button based on its current setting after said event. Might be a difficult explanation to understand but if anybody is interested please e-mail me if you want further explanation.

    G 1 Reply Last reply
    0
    • M Matthew Devine

      I am currently developing a little IE deskband that gives the user the ability to hotswap between proxy settings with the click of a button, the button then changes to the user knows what the current proxy setting is(Green Means Proxy On|Red Means Proxy off). The one problem I am running into is the fact that it is able to determine the proxy setting when I start IE and thus the button is correctly set, but if I manually change the proxy through IE via Tools -> Internet Options -> Connection Tab -> Lan Settings, the button doesn't update. I was wondering if there is anyway I could envoke a ilstener that would be able to notice when I manaully change the proxy and then set the button based on its current setting after said event. Might be a difficult explanation to understand but if anybody is interested please e-mail me if you want further explanation.

      G Offline
      G Offline
      Gerald Schwab
      wrote on last edited by
      #2

      Use RegNotifyChangeKeyValue() to watch this registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings http://msdn.microsoft.com/library/en-us/sysinfo/base/regnotifychangekeyvalue.asp?frame=true[^]

      M 1 Reply Last reply
      0
      • G Gerald Schwab

        Use RegNotifyChangeKeyValue() to watch this registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings http://msdn.microsoft.com/library/en-us/sysinfo/base/regnotifychangekeyvalue.asp?frame=true[^]

        M Offline
        M Offline
        Matthew Devine
        wrote on last edited by
        #3

        Thanks for pointing me in the right direction Gerald. but I can't quite seem to figure out how to exactly write something that would actively monitor for a change in this registry key. Any help with this would be greatly appreciated. I'm not an expert developer so you'll have to bear with me.

        G 1 Reply Last reply
        0
        • M Matthew Devine

          Thanks for pointing me in the right direction Gerald. but I can't quite seem to figure out how to exactly write something that would actively monitor for a change in this registry key. Any help with this would be greatly appreciated. I'm not an expert developer so you'll have to bear with me.

          G Offline
          G Offline
          Gerald Schwab
          wrote on last edited by
          #4

          RegNotifyChangeKeyValue monitors the registry key for you. If you use the RegNotifyChangeKeyValue synchronously, then it waits until a subkey has changed before continuing execution. You could use a loop and continue to moniter. If you use RegNotifyChangeKeyValue asynchronously, then you wait on the event instead. Run the code below. It will wait during the call to RegNotifyChangeKeyValue. Then change your proxy setting through IE and click ok. Then you will see the MessageBox.

          #include <tchar.h>
          #include <windows.h>

          INT WINAPI
          _tWinMain (
          HINSTANCE hInstance,
          HINSTANCE hPrevInstance,
          LPTSTR lpCmdLine,
          INT nCmdShow
          )
          {
          LONG l = 0L;
          HKEY hKey = {0};

          l = RegOpenKeyEx (
                  HKEY\_CURRENT\_USER,
                  \_T("Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Internet Settings"),
                  0, 
                  KEY\_NOTIFY,
                  &hKey );
                  
                  
          if(l == ERROR\_SUCCESS)
          {
              // The following call will wait until a change is made to the registry key.
              l = RegNotifyChangeKeyValue ( 
                      hKey,
                      FALSE,
                      REG\_NOTIFY\_CHANGE\_LAST\_SET,
                      NULL,
                      FALSE );
                      
              MessageBox(NULL, \_T("Registry key changed"), \_T("Registry key changed"), 0);
              RegCloseKey(hKey);                
          }                
          
          return 0;
          

          }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups