changes on windows registry doesn’t take effect immediately

iMath redstone-cold at 163.com
Fri Mar 15 06:26:50 CET 2013


changes on windows registry doesn’t take effect immediately

I am trying to change IE’s proxy settings by the following 2 code snippets 

to enable the proxy by this code 

from winreg import *
with OpenKey(HKEY_CURRENT_USER,r"Software\Microsoft\Windows\CurrentVersion\Internet Settings" ,0, KEY_ALL_ACCESS) as key:
    SetValueEx(key,"ProxyServer",0, REG_SZ, "127.0.0.1:8087")
    SetValueEx(key,"ProxyEnable",0, REG_DWORD, 1)
    SetValueEx(key,"ProxyOverride",0, REG_SZ, "<local>")
FlushKey(key)

to disable the proxy by this code 

from winreg import *
with OpenKey(HKEY_CURRENT_USER,r"Software\Microsoft\Windows\CurrentVersion\Internet Settings" ,0, KEY_ALL_ACCESS) as key:

    DeleteValue(key,"ProxyServer")
    SetValueEx(key,"ProxyEnable",0, REG_DWORD, 0)
    DeleteValue(key,"ProxyOverride")
    FlushKey(key)

but the changes on windows registry doesn’t take effect immediately,so is there some way to change the windows registry and let the changes  take effect immediately without restarting IE ?

BTW ,I use the code on winxp ,and I am going to embed the 2 code snippets in my PyQt application .



More information about the Python-list mailing list