Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python windows注册表上的更改不存在’;我不能立即生效_Python_Windows_Qt_Internet Explorer_Pyqt - Fatal编程技术网

Python windows注册表上的更改不存在’;我不能立即生效

Python windows注册表上的更改不存在’;我不能立即生效,python,windows,qt,internet-explorer,pyqt,Python,Windows,Qt,Internet Explorer,Pyqt,windows注册表上的更改不会立即生效 我试图通过以下两个代码片段更改IE的代理设置 要通过此代码启用代理,请执行以下操作 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,

windows注册表上的更改不会立即生效

我试图通过以下两个代码片段更改IE的代理设置

要通过此代码启用代理,请执行以下操作

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)
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)
但是windows注册表上的更改不会立即生效,那么有没有办法更改windows注册表并让更改在不重新启动IE的情况下立即生效


顺便说一句,我使用winxp上的代码,我将在我的PyQt应用程序中嵌入这两个代码段。

让我们这样试试:我讨厌太多的重新启动,并与之抗争,因此,你可以尝试卸载ieplore.dll,然后重新加载它,但是没有崩溃IE。提到的*.dll是IE的核心,而且非常棘手,例如,*.chm文件在没有IE的情况下加载,如果URL在其中,它将打开并加载,并且您不会看到任务管理器中正在运行IE进程。

根据您所要执行的操作,完全重新启动似乎是不必要的。一旦打开新的Internet Explorer,这些设置将应用于新的Internet Explorer和任何其他应用程序(如Firefox)

如果要编写脚本,可能需要使用嵌入式Internet Explorer创建一个隐藏窗口

同样,根据您所追求的,可能有现成的工具可以实现这一点。它解决了我的需要:我现在正在使用