参考文章:

  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;
}

VC设置代理方法的更多相关文章

  1. webservice axis2客户端设置代理方法(公司网络通过代理访问时)

    webservice axis2客户端设置代理方法(公司网络通过代理访问时)   UploadProcessInServiceStub stub = new UploadProcessInServic ...

  2. github for window 中 git shell 设置代理方法和解决ssl证书错误的问题

    体验了一下传说中的 github for windows(操作git有很多的方法,我还没有学会,所以找了个简单的方法),听说用起来还不错,毕竟也开始接触了github.下载地址是 http://win ...

  3. urllib,request 设置代理

     通常防止爬虫被反主要有以下几个策略: 1.动态设置User-Agent(随机切换User-Agent,模拟不同用户的浏览器信息) 2.使用IP地址池:VPN和代理IP,现在大部分网站都是根据IP来b ...

  4. ios开发网络学八:NSURLSession相关代理方法

    #import "ViewController.h" @interface ViewController ()<NSURLSessionDataDelegate> /* ...

  5. scrapy设置代理的方法

    方法一: 直接在spider文件下设置代理,通过传参的方式设置在Request中 import scrapy class MimvpSpider(scrapy.spiders.Spider): nam ...

  6. collectionView代理方法快速设置cell大小上下左右间隔

    #define JianGe 25 #define GeShu 4 #define ScreenWidth ([UIScreen mainScreen].bounds.size.width) #def ...

  7. 如何在android studio 1.0 启动时设置代理【解决WARN - ateSettings.impl.UpdateChecker - Connection failed.】

    今天第一次用android studio,下了个比较新的1.0.1 linux版本,结果启动时老是出现以下错误: [ 6987] WARN - ateSettings.impl.UpdateCheck ...

  8. 通读AFN②--AFN的上传和下载功能分析、SessionTask及相应的session代理方法的使用细节

    这一部分主要研究AFN的上传和下载功能,中间涉及到各种NSURLSessionTask的一些创建的解析和HTTPSessionManager对RESTful风格的web应用的支持,同时会穿插一点NSU ...

  9. UITextField的代理方法:textField:shouldChangeCharactersInRange:replacementString

    原文链接:http://www.cnblogs.com/zhanggui/p/6101813.html 这个我在开发的过程中用到的次数最多,因此这里就简单对其进行分析.先看看Command+点击 弹出 ...

随机推荐

  1. Javascript - Vue - 过滤器

    过滤器 输出的数据由vue对象提供,但它的数据可能需要做进一步的处理才适合展示给用户看,为此,可以在静态的Vue上定义一个过滤器对实例vue对象的data数据进行过滤处理. //调用过滤器//msg是 ...

  2. git 修改已提交的注释

    在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息 修改最后一次提交注释 git commit --amend 然后在出来的编辑界面,直接编辑注释的信息,保存退出 gi ...

  3. 【网络编程】使用getnameinfo()/getaddrinfo()/InetPton()

    1.简要 从前用的网络编程函数现在又做了一定的改动,报了这么3个错误. error C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead ...

  4. Google Protocol Buffer的安装与.proto文件的定义(转)

    转自(https://www.cnblogs.com/yinheyi/p/6080244.html) 什么是protocol Buffer呢? Google Protocol Buffer( 简称 P ...

  5. MySQL root密码忘记后更优雅的解决方法

    MySQL root密码忘记后更优雅的解决方法 https://www.jb51.net/article/143453.htm /usr/bin/mysqld_safe --defaults-file ...

  6. IntelliJ IDEA快捷键:F12

    The F12 key moves the focus from the editor to the last focused tool window. 将焦点从编辑器移动到最后一个聚焦的工具窗口.

  7. 事务ACID特性

    所谓事务,它是一个操作序列,这些操作要么都执行,要么都不执行,它是一个不可分割的工作单位.例如,银行转帐工作:从一个帐号扣款并使另一个帐号增款,这两个操作要么都执行,要么都不执行. 数据库事务必须具备 ...

  8. Oracle 11g R2 32位 & Oracle 11g R2 64位 -百度云下载

    Oracle 11g R2 32位 & Oracle 11g R2 64位 -百度云下载 https://pan.baidu.com/s/1fuzy67Olfxzsy3WJMCrCnQ 提取码 ...

  9. fiddler抓https 关于证书一项

    由于我之前电脑装过fiddler然后这次弄证书也没有理解明白,导致失败了.然后就百度到了下面的教程. https://www.cnblogs.com/joshua317/p/8670923.html ...

  10. MySQL连接表

    一:MySQL别名 1.介绍 使用MySQL别名来提高查询的可读性. MySQL支持两种别名,称为列别名和表别名. 有时,列的名称是一些表达式,使查询的输出很难理解.要给列一个描述性名称,可以使用列别 ...