Private Sub Form_Load()
Appdisk = Trim(App.Path)
If Right(Appdisk, 1) <> "\" Then Appdisk = Appdisk & "\"
Text1.Text = ReadIniFile(Appdisk & "\set.ini", "CONFIG", "WangZhi")
Text2.Text = ReadIniFile(Appdisk & "\set.ini", "CONFIG", "Wait")
Check1.Value = Val(ReadIniFile(Appdisk & "\set.ini", "CONFIG", "Check"))
If Check1.Value = 1 Then Me.Hide
Check1.Value = 1
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call INIWrite("CONFIG", "WangZhi", Text1.Text, Appdisk & "\set.ini") '提取源码的网址
Call INIWrite("CONFIG", "Wait", Text2.Text, Appdisk & "\set.ini") '等待的时间
Call INIWrite("CONFIG", "Check", Check1.Value, Appdisk & "\set.ini") '是否显示界面
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
KeyAscii = 8
Exit Sub
End If
If KeyAscii < 47 Or KeyAscii > 58 Then
KeyAscii = 0
Beep '声音
End If
End Sub
Private Sub Text2_LostFocus()
If Text2.Text = "" Then Text2.Text = "5"
End Sub
Private Sub Timer1_Timer()
Minute = Minute + 1
If Minute = Val(Text2.Text) Then
JiLu Time & "请求获取源码!"
Yuan = ReadinteFile("http://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=" & Text1.Text)
'If InStr(Yuan, "关机") Then QuitSystemWin 0
'If InStr(Yuan, "重启") Then QuitSystemWin 1
If InStr(Yuan, "关机") Then MsgBox "关机"
If InStr(Yuan, "重启") Then MsgBox "重启"
'请修改上面的代码实现功能
Minute = 0
End If
End Sub
Public Function ReadinteFile(ByVal sUrl As String) As String
Dim xmlHTTP1 As Object
Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
xmlHTTP1.Open "get", sUrl, True
xmlHTTP1.send
While xmlHTTP1.readyState <> 4
DoEvents
Wend
ReadinteFile = xmlHTTP1.responseText
Set xmlHTTP1 = Nothing
End Function
Private Sub JiLu(MakStr As String)
On Error Resume Next
Dim F As String, H As Long
F = Appdisk & "\运行记录.txt"
H = FreeFile
Open F For Append As #H
Print #H, MakStr
Close #H
End Sub