| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1528 人关注过本帖
标题:请教高手,如何为WEBBROWER设置HTTPS代理
取消只看楼主 加入收藏
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1216
专家分:1376
注 册:2005-3-14
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
请教高手,如何为WEBBROWER设置HTTPS代理
用以下函数设置代理可以打开HTTP页面,但HTTPS打不开,如不能登录163邮箱,
--------------------------------------------------
Option Explicit
Private Type INTERNET_PROXY_INFO
    dwAccessType    As Long
    lpszProxy       As String
    lpszProxyBypass As String
End Type
Private Const INTERNET_OPTION_PROXY = 38
Private Const INTERNET_OPTION_SETTINGS_CHANGED = 39
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Declare Function InternetSetOption Lib "wininet.dll" Alias "InternetSetOptionA" (ByVal hInternet As Long, ByVal dwOption As Long, ByRef lpBuffer As Any, ByVal dwBufferLength As Long) As Long

--------------------------------------------------

Private Sub SetProxy(aStrIP As String, aStrPort As String, aBolUseProxy As Boolean)
    Dim strProxy As String
    Dim inf As INTERNET_PROXY_INFO
   
    aStrIP = Trim(aStrIP)
    aStrPort = Trim(aStrPort)
    If (aStrIP + aStrPort = "") Or Not aBolUseProxy Then
      strProxy = ""
    Else
      strProxy = "http=" + aStrIP + ":" + aStrPort
    End If
   
    If Trim(strProxy) <> "" Then
      inf.dwAccessType = INTERNET_OPEN_TYPE_PROXY
      inf.lpszProxy = strProxy
      inf.lpszProxyBypass = ""
      Call InternetSetOption(0, INTERNET_OPTION_PROXY, inf, Len(inf))
      Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, "", 0)
    Else
      inf.dwAccessType = INTERNET_OPEN_TYPE_DIRECT
      inf.lpszProxy = ""
      inf.lpszProxyBypass = ""
   
      Call InternetSetOption(0, INTERNET_OPTION_PROXY, inf, Len(inf))
      Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, "", 0)
    End If
End Sub

---------------------------------------------------
 

SetProxy txtip.Text, txtport.Text, True
WebBrowser1.Navigate stURL

谢谢!
搜索更多相关主题的帖子: 代理 WEBBROWER HTTPS 
2009-11-25 15:44
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1216
专家分:1376
注 册:2005-3-14
收藏
得分:0 
回复 2楼 三断笛
不是修改系统中IE属性中的代理,而是只对当前应用程序设置代理,

如自已写一个浏览器,可以设置自已的代理.

http://toorup.3v.do
loading...
2009-11-29 23:38
快速回复:请教高手,如何为WEBBROWER设置HTTPS代理
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022460 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved