我想要实现第二段代码的原来的功能,现在我用你的这两段代码合起来,程序就报错了。
这段代码能代替吗,语句报错。
Dim url As String = "http://api.k780.com:88/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json"
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
stm.Dispose()
Output.Show(str)
Dim data As object
Dim JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}"
Dim ScriptControl = CreateObject("MSScriptControl.ScriptControl")
With ScriptControl
.Language = "Javascript"
.Timeout = -1
.AddCode(JscriptCode)
data = .Run("toObject", str)
End With
Dim d As Date = data.result.datetime_1
msgbox(d)
web.Refresh
Dim data As Date = web.Document.Body.InnerText ' 日期对比
Dim d As Date = "2016-06-30"
Dim Code As String = GetConfigValue("Register" & ComputerId,"")
Dim Ok As Boolean
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确
OK = True
Else
If data>d Then '
Forms("注册").Open()
Code = GetConfigValue("Register" & ComputerId,"")
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确
OK = True
End If
End If
If data>d AndAlso Ok = False Then
Messagebox.Show("您正在使用的产品已经超期!")
Syscmd.Project.Exit()
End If
End If
使用注册语句
Dim url As String = "http://foxtable.sinaapp.com/time/?f=Y-m-d"
Dim web As New System.Windows.Forms.WebBrowser()
web.Navigate(url)
Do Until web.ReadyState = 4
Application.DoEvents
Loop
web.Refresh
Dim data As Date = web.Document.Body.InnerText ' 日期对比
Dim d As Date = "2016-06-30"
Dim Code As String = GetConfigValue("Register" & ComputerId,"")
Dim Ok As Boolean
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确
OK = True
Else
If data>d Then '
Forms("注册").Open()
Code = GetConfigValue("Register" & ComputerId,"")
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确
OK = True
End If
End If
If data>d AndAlso Ok = False Then
Messagebox.Show("您正在使用的产品已经超期!")
Syscmd.Project.Exit()
End If
End If