VB.NET修改代理服务器应用技巧分享
今天我们为大家带来的应用技巧,主要就是为了讲解一些在邮箱自动注册方面所需要实现的一些需求。在这篇文章里就是关于VB.NET修改代理服务器的相关实现方法,大家可以通过介绍充分的掌握。
如果一个IP在一段时间过多的注册,则该IP会被封调,一个办法就是修改注册表以实现VB.NET修改代理服务器。在这里我使用一个API函数internetsetoption,使用之前要添加一个模块,然后加入如下代码:
Public Const internet_option_proxy = 38 Public Const INTERNET_OPEN_TYPE_PROXY = 3 Public Const INTERNET_OPTION_SETTINGS_CHANGED = 39 Type INTERNET_PROXY_INFO dwAccessType As Long lpszProxy As String lpszProxyBypass As String End Type Public 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
改代码定义了三个常数和一个结构,该API函数的具体用法请大家查询MSDN。VB.NET修改注册表的办法就太多了,我就不多说了。在WebBrowser1_DocumentComplete事件中在添加一个条件语句,用以判断是否是IP被封的提示页面,代码如下:
If InStr(doc.body.innerText, "IP地址在这一段时间内已经注册了太多的用户") > 0 Then Dim options As INTERNET_PROXY_INFO options.dwAccessType = INTERNET_OPEN_TYPE_PROXY options.lpszProxy = "168.10.46.77:80" options.lpszProxyBypass = "" internetsetoption 0, internet_option_proxy, options, LenB(options) Dim don As Double Dim doff As Double Set reg = CreateObject("Wscript.Shell") a = reg.regwrite("HKEY_CURRENT_USER\Software\Microsoft\ Windows\CurrentVersion\Internet Settings\ProxyServer", _ "211.144.96.250:80") a = reg.regwrite("HKEY_CURRENT_USER\Software\Microsoft\ Windows\CurrentVersion\Internet Settings\ProxyEnable", _ 1) internetsetoption 0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0 WebBrowser1.Navigate "http://freemail.eyou.com/signup.html? bgp=%CE%D2%BD%D3%CA%DC&bgp_enable=on" End If
相关推荐
windle 2020-10-29
scaleqiao 2020-10-22
superyu 2020-09-10
xcznb 2020-06-26
LandryBean 2020-06-17
furongwei 2020-06-09
clmngu 2020-06-06
windzoone 2020-05-29
huangzonggui 2020-05-28
itmale 2020-05-26
BuildingUtil 2020-05-09
leodengzx 2020-05-11
MichelinMessi 2020-04-20
huangzonggui 2020-04-16
魏莉的微 2020-04-08
zongyuewang 2020-03-30
wxthillwill 2020-03-06
sicceer 2020-02-23
SoarFly00 2020-02-03