开发者

Detect Windows (IE) proxy settings changes

I'm using WinHttpGetIEProxyConfigForCurrentUser and friends to gather the current proxy information when my app starts as doing it before each request seems to degrade performance greatly with it something sitting for a few seconds gatheri开发者_Python百科ng the proxy data. Is there a way to detect when the Windows proxy settings have changed so I can cache the information until it changes?

Thanks, J


Not sure if there is a better way, but you could always take the nuclear option and use RegNotifyChangeKeyValue with HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings.


Could you run the detection in a background thread upon application startup?

I found nothing about WinHttpGetIEProxyConfigForCurrentUser not being callable from within the non-main-UI thread.

If the application needs the result of the WinHttpGetIEProxyConfigForCurrentUser faster than the background thread returns, you could make it blocking again until the background thread is finished.


I'm not sure if it is generated with proxy setting changes or not, but there might be a WM_SETTINGCHANGE message that you could handle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜