VC设置代理方法
2024-10-12 09:38:40
参考文章:
- VC 设置代理
- Setting and Retrieving Internet Options
- Change Internet Proxy settings
- http://support.microsoft.com/kb/226473
- 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:
- Create an INTERNET_PER_CONN_OPTION_LIST structure.
- Allocate the memory for the individual Internet options that you want to set for the connection.
- Set the options in INTERNET_PER_CONN_OPTION structures.
- 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;
}
最新文章
- C#-WinForm-MDI窗体容器、权限设置
- Win下,通过Jstack截取Java进程中的堆栈信息
- 让我们喝喝下午茶,聊聊AJAX和JSON
- Ajax工作原理(转)
- Xcode 8 打印输出: Class PLBuildVersion is implemented in both...
- Maven学习(三) -- 仓库
- Isomorphic JavaScript: The Future of Web Apps
- java学习笔记day01
- Fragment实现不支持左右滑动的Tab
- WebSocket协议:5分钟从入门到精通
- Python系列之 - 线程基础
- NPM实用指北
- Bitmap上下合成图片
- 《用Python写爬虫》学习笔记(一)
- java 反射模式
- 019-并发编程-java.util.concurrent之-Semaphore 信号量
- git如何撤销git add操作?
- python实现netcat部分功能源代码
- id特性
- MVC实战之排球计分(三)—— 模型类的设计与实现
热门文章
- 求矩形的周长(线段树+扫描线) Picture POJ - 1177
- 洛谷 P5206: bzoj 5475: LOJ 2983: [WC2019] 数树
- [转]使用 mitmproxy + python 做拦截代理
- IPsec学习笔记
- MVC Autofac依赖注入
- android view的多种移动方式(测试集合)
- Demo005 小学四则运算自动生成程序
- hdu 2795 公告板 (单点最值)
- TypeScript的HTML5游戏
- 【LOJ】#2116. 「HNOI2015」开店