1.设置浏览器代理
(1)注册表位置
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
(2)设置代理的代码
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#define PROXY_REG_ITEM "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
// Set IE Proxy
//
// HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
// ProxyEnable:
// 0 proxy is disable
// 1 proxy enable.
BOOL SetProxy(BOOL bEnabled, const char *szProxyServ)
{
HKEY hKey = NULL;
LONG lret = RegOpenKeyEx(HKEY_CURRENT_USER, PROXY_REG_ITEM, NULL, KEY_WRITE | KEY_SET_VALUE, &hKey);
if (hKey == NULL || lret != ERROR_SUCCESS){
return FALSE;
}
// enable or d