http://www.lecai.com/lottery/draw/view/200?phase=20130312072&agentId=5555 号码如何用VB时时获取

2022-11-11 21:03发布

自己加个计时器定时刷新Option ExplicitPrivate Sub Command1_Click() Dim ul As String, mark
1条回答
1楼 · 2022-11-11 21:50.采纳回答
'自己加个计时器定时刷新
Option Explicit
Private Sub Command1_Click()
Dim ul As String, mark As String, s As String, temp As String
ul = "http://www.lecai.com/lottery/draw/view/200?phase=20130312072&agentId=5555"
Command1.Enabled = False
With CreateObject("InternetExplorer.Application")
.Visible = False
.navigate ul
Do Until .readyState = 4
DoEvents
Loop
s = .document.body.innerhtml
End With
mark = "latest_draw_time = "
If InStr(s, mark) = 0 Then
Command1.Enabled = True
Exit Sub
End If
temp = Mid(s, InStr(s, mark) + Len(mark) + 1, 20) & vbNewLine
mark = "var phaseData = {""" & Format(Date, "yyyy-mm-dd") & """:"
s = Mid(s, InStr(s, mark) + Len(mark), Len(s))
mark = """red"""
s = Mid(s, InStr(s, mark) + Len(mark) + 2, 19)
temp = temp & s
MsgBox temp
Command1.Enabled = True
End Sub更多追问追答追问

多实验几次出现错误提示 

    • 我开始时在win7运行正常的,多实验几次突然发现这个错误。追答
      你可以先建立一个对象,然后在最后把这个对象注销掉再试试,set obj=nothing,我是直接创建然后完成任务后消失,可能不同系统结果不一样,你自己测试一下。

一周热门 更多>