我用的是WebBrowser 控件,访问要刷点击的文章。定时器定时刷新,同时清除本地的cookie。就可以实现刷点击啦。
Public webBrowNum As Integer = 0 Public webBrowUrl As String = "" Public articleList As List(Of String) = New List(Of String) Private Declare Function GetUrlCacheEntryInfo Lib "wininet.dll" Alias "GetUrlCacheEntryInfoA" (ByVal sUrlName As String,ByRef lpCacheEntryInfo As IntPtr,ByRef lpdwCacheEntryInfoBufferSize As IntPtr) As Integer Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Integer
Private Sub Form1_Load(sender As Object,e As EventArgs) Handles MyBase.Load articleList.Add("http://blog.csdn.net/u013162930/article/details/47606875") articleList.Add("http://blog.csdn.net/u013162930/article/details/47396257") articleList.Add("http://blog.csdn.net/u013162930/article/details/48316613") articleList.Add("http://blog.csdn.net/ld_____/article/details/48133523") Dim skipInterval As Integer = 2000 WebBrowser1.ScriptErroRSSuppressed = True WebBrowser1.Navigate("http://blog.csdn.net/u013162930?viewmode=list") WebBrowser1.Refresh() Timer1.Interval = skipInterval Timer1.Enabled = True End Sub
Private Sub Timer1_Tick(sender As Object,e As EventArgs) Handles Timer1.Tick webBrowUrl = articleList(webBrowNum) webBrowNum = webBrowNum + 1 If webBrowNum >= articleList.Count Then webBrowNum = 0 End If interviewUrl() End Sub
Private Sub interviewUrl() TextBox1.Text = webBrowUrl WebBrowser1.Navigate(webBrowUrl) WebBrowser1.Refresh() Application.DoEvents() '清除Cookie If WebBrowser1.Document.Cookie IsNot Nothing Then WebBrowser1.Document.Cookie.Remove(0,WebBrowser1.Document.Cookie.Count) End If Application.DoEvents() If (InCache("http://blog.csdn.net")) Then DeleteCacheURL("http://blog.csdn.net") End If End Sub
学好技术,写好博文才是王道。
不然也不好意思多刷啊~