Change My IE proxy server

斜淳
2023-12-01

in my Lab,the net is Education Research net, I need to use a proxy for getting access to foreign country site. and sometimes the proxy of our school is not work well,but I still have a good friend's proy. As for me,  I don't like to change to it in IE by through many click and input the proxy server,port.

Now by reference :http://www.codeproject.com/internet/changeproxy1.asp

I make my program only one click for setting:

void CProxy_ToggleDlg::OnGdutproxy()
{
 // TODO: Add your control notification handler code here
 HKEY hk;
 DWORD dwEnable = 1;
 
 char* pch_ServerName = "PROXY.GDUT.EDU.CN:8080";
 char* pch_ProxyOverride = "<local>";
 LONG lret = RegOpenKeyEx(HKEY_CURRENT_USER, "Software//Microsoft//Windows//CurrentVersion//Internet Settings", NULL, KEY_WRITE|KEY_SET_VALUE, &hk);
 if(lret != ERROR_SUCCESS)
 {
  MessageBox("Can't Open Register!");
  return;  
 }
 lret |= RegSetValueEx(hk, "ProxyServer", NULL, REG_SZ, (LPBYTE)pch_ServerName, strlen(pch_ServerName));
 lret |= RegSetValueEx(hk, "ProxyEnable", NULL, REG_DWORD, (LPBYTE)&dwEnable, sizeof(dwEnable));
 lret |= RegSetValueEx(hk, "ProxyOverride", NULL, REG_SZ, (LPBYTE)pch_ProxyOverride, strlen(pch_ProxyOverride));
 if(lret!= 0)
 {
  MessageBox("Error write Register!");
  return; 
 } 
 InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
 InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
}

 类似资料:

相关阅读

相关文章

相关问答