参考文章:

  1. VC 设置代理
  2. Setting and Retrieving Internet Options
  3. Change Internet Proxy settings
  4. http://support.microsoft.com/kb/226473
  5. http://bbs.csdn.net/topics/310192443
Setting Connection Options

In Internet Explorer 5 and later, Internet options can be set for on a specific connection. Previously, all connections shared the same Internet option settings. To set options for a particular connection:

  1. Create an INTERNET_PER_CONN_OPTION_LIST structure.
  2. Allocate the memory for the individual Internet options that you want to set for the connection.
  3. Set the options in INTERNET_PER_CONN_OPTION structures.
  4. Set the options using InternetSetOption.

BOOL SetConnectionOptions()
{
INTERNET_PER_CONN_OPTION_LIST list;
BOOL bReturn;
DWORD dwBufSize = sizeof(list); // Fill the list structure.
list.dwSize = sizeof(list); // NULL == LAN, otherwise connectoid name.
list.pszConnection = NULL; // Set three options.
list.dwOptionCount = 3;
list.pOptions = new INTERNET_PER_CONN_OPTION[3]; // Ensure that the memory was allocated.
if(NULL == list.pOptions)
{
// Return FALSE if the memory wasn't allocated.
return FALSE;
} // Set flags.
list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT |
PROXY_TYPE_PROXY; // Set proxy name.
list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
list.pOptions[1].Value.pszValue = TEXT("http://proxy:80"); // Set proxy override.
list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
list.pOptions[2].Value.pszValue = TEXT("local"); // Set the options on the connection.
bReturn = InternetSetOption(NULL,
INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize); // Free the allocated memory.
delete [] list.pOptions; return bReturn;
}

最新文章

  1. C#-WinForm-MDI窗体容器、权限设置
  2. Win下,通过Jstack截取Java进程中的堆栈信息
  3. 让我们喝喝下午茶,聊聊AJAX和JSON
  4. Ajax工作原理(转)
  5. Xcode 8 打印输出: Class PLBuildVersion is implemented in both...
  6. Maven学习(三) -- 仓库
  7. Isomorphic JavaScript: The Future of Web Apps
  8. java学习笔记day01
  9. Fragment实现不支持左右滑动的Tab
  10. WebSocket协议:5分钟从入门到精通
  11. Python系列之 - 线程基础
  12. NPM实用指北
  13. Bitmap上下合成图片
  14. 《用Python写爬虫》学习笔记(一)
  15. java 反射模式
  16. 019-并发编程-java.util.concurrent之-Semaphore 信号量
  17. git如何撤销git add操作?
  18. python实现netcat部分功能源代码
  19. id特性
  20. MVC实战之排球计分(三)—— 模型类的设计与实现

热门文章

  1. 求矩形的周长(线段树+扫描线) Picture POJ - 1177
  2. 洛谷 P5206: bzoj 5475: LOJ 2983: [WC2019] 数树
  3. [转]使用 mitmproxy + python 做拦截代理
  4. IPsec学习笔记
  5. MVC Autofac依赖注入
  6. android view的多种移动方式(测试集合)
  7. Demo005 小学四则运算自动生成程序
  8. hdu 2795 公告板 (单点最值)
  9. TypeScript的HTML5游戏
  10. 【LOJ】#2116. 「HNOI2015」开店