Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 618331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:32:01+00:00 2026-05-13T18:32:01+00:00

[Disclaimer: this is a Windows 7 specific issue as far as I can tell]

  • 0

[Disclaimer: this is a Windows 7 specific issue as far as I can tell]

I’ve got a block of code that changes the proxy settings in the Windows registry, then proceeds to call the WinInet API with the following:

InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);

This is completely fine in XP and Vista, however in Windows 7 something has apparently changed, and for some reason the previous registry keys get injected back in causing it to not work as expected.

If I comment out those two lines of code, the registry values stick, but obviously IE and other applications relying on that proxy information have no idea that the configuration has changed.

Is there a better way to handle notifying the system that the options have changed and need to be reloaded? I have searched for days on this issue, switched compilers, etc., and nothing I do makes it work as I would expect in Windows 7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:32:01+00:00Added an answer on May 13, 2026 at 6:32 pm

    FWIW my original problem was not using the entire WinInet API to handle the proxy settings. The answer has been staring me in the face from the beginning… A final solution might look something like:

    LPWSTR proxyName;
    
    if (on) {
        proxyName = L"http=[IPADDRESS:PORT];https=[IPADDRESS:PORT]";
    } else {
        proxyName = 0;
    }
    
    INTERNET_PER_CONN_OPTION_LIST OptionList;
    INTERNET_PER_CONN_OPTION Option[3];
    unsigned long listSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
    Option[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
    Option[1].dwOption = INTERNET_PER_CONN_FLAGS;
    Option[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
    OptionList.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
    OptionList.pszConnection = NULL;
    OptionList.dwOptionCount = 3;
    OptionList.dwOptionError = 0;
    
    DWORD proxyType = PROXY_TYPE_DIRECT; // this proxy type disables any proxy server
    
    if (proxyName) {
        if (proxyName[0]) {
            proxyType = PROXY_TYPE_PROXY; // a name has been passed, so choose the correct proxy type for enabling the proxy server
        }
    }
    
    Option[0].Value.pszValue = (LPWSTR)proxyName;
    Option[1].Value.dwValue = proxyType;
        if (on) {
                Option[2].Value.pszValue = (LPWSTR)L"";
        } else {
                Option[2].Value.pszValue = (LPWSTR)L"";
        }
    OptionList.pOptions = Option;
    
        if (!InternetSetOption(0, INTERNET_OPTION_PER_CONNECTION_OPTION, &OptionList, listSize)) {
                // handle error
        }
    
    InternetSetOption(0, INTERNET_OPTION_REFRESH, NULL, NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: I realize I can generate this at runtime in Java, this was needed
( Disclaimer: This question is not specific to ASP.NET) I have a control which
Disclaimer: this is needed for an old and ugly codebase that I'd much rather
Disclaimer : This is for a semester project that I am currently working on.
Disclaimer: this was a homework problem. The deadline has passed now, so discussions can
Disclaimer: Ok I know that this is being discussed in the thread linked below,
Disclaimer: This is not actually a programming question, but I feel the audience on
Disclaimer: This is for a homework assignment, but the question is not regarding the
Disclaimer This is not strictly a programming question, but most programmers soon or later
Disclaimer: This is my first time writing unit tests...be gentle! :) I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.