以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]请教:如何限制更改电脑系统日期  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=74987)

--  作者:time
--  发布时间:2015/9/24 0:40:00
--  [求助]请教:如何限制更改电脑系统日期
比如用户今天更新了狐表数据库系统,而且所更新的系统是昨天发布的,请问假如用户把电脑系统日期修改为前天的日期,则系统无法打开,并提示用户把时间修改为当天的互联网标准时间?如果可以实现请告知完整的代码,谢谢!
--  作者:大红袍
--  发布时间:2015/9/24 9:32:00
--  
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://foxtable.sinaapp.com/time/  ")
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()
Dim d As Date = str
Dim sp As TimeSpan = Date.Now - d
If math.Abs(sp.TotalHours) > 1 Then
    msgbox("你系统的时间不正确")
End If

--  作者:time
--  发布时间:2015/9/30 23:22:00
--  

经测试,只提示系统时间不正确,但是稍后还是能正常启动。是不是我把上列代码放错地方了,请指导。


--  作者:大红袍
--  发布时间:2015/10/4 12:21:00
--  

退出系统,写代码

 

Dim ps As  System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("foxtable")
For Each p As System.Diagnostics.Process In ps
    If p.MainWindowTitle = Nothing OrElse p.MainWindowTitle = basemainform.Text Then
        p.kill
        Exit For
    End If
Next