如何编写代理软件,实现IE-internet选项--连接--代理服务器的功能 ?

nba23 2003-10-23 08:21:00
UP
...全文
88 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
TechnoFantasy 2003-10-23
  • 打赏
  • 举报
回复
InternetSetOption 的用发:

Comment from DChrome
Date: 07/16/2003 04:09PM PDT Comment

You can modify the registry settings:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]

But you should do it only if you are 100% sure of what you are doing. This is not a good thing to mess up with the registry.

There's another way - using InternetSetOption function from "wininet.dll".
I don't have any ready code to post here. It's a bit complicated so I can only propose the idea. Maybe other experts here can give you a copy and paste solution.

Hope this somehow helps.


Accepted Answer from Biffo
Date: 07/17/2003 08:47AM PDT Accepted Answer

InternetSetOption isn't complicated for this task, DChrome. Here is what my nitwit brother-in-law needs to do:

'Declare Options

Private Type INTERNET_PROXY_INFO
dwAccessType As Long
lpszProxy As Long
lpszProxyBypass As Long
End Type

Private Const ERROR_INSUFFICIENT_BUFFER = 122
Private Const INTERNET_OPTION_PROXY = 38
Private Const INTERNET_OPEN_TYPE_DIRECT = 1

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

'On form add a command1 button


Private Sub Command1_Click()

Dim iRet As Long
Dim ProxyInfo As INTERNET_PROXY_INFO


ProxyInfo.dwAccessType = INTERNET_OPEN_TYPE_PROXY
ProxyInfo.lpszProxy = "http=127.0.0.1:8080"
ProxyInfo.lpszProxyBypass = "<local>"


iRet = InternetSetOption(0&, INTERNET_OPTION_PROXY, ProxyInfo, LenB(ProxyInfo))
'
If iRet <> 0 Then
MsgBox "Now Using Proxy Service.", vbInformation
Else
MsgBox "Error in Setting IE Proxy Service.", vbInformation
End If

End Sub

'end

TechnoFantasy 2003-10-23
  • 打赏
  • 举报
回复
API函数InternetSetOption 或者修改注册表:


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]

Dublue 2003-10-23
  • 打赏
  • 举报
回复
这么笼统的问题~~
since1990 2003-10-23
  • 打赏
  • 举报
回复
up
aha99 2003-10-23
  • 打赏
  • 举报
回复
mytt@eyou.com
给你个例子
nba23 2003-10-23
  • 打赏
  • 举报
回复
CSDN 居然没有会???????????????

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧