Func StartClick() ;开始刷课函数 这已经是一个由GUI界面上的START按钮响应的函数了
If GUICtrlRead($kcmdList) = "" Then
GUICtrlSetData($StateShow,@CRLF&"选课名单为空→")
Return
ElseIf $reTime = -1 Then
GUICtrlSetData($StateShow,"←请选择刷课模式"&@CRLF&@CRLF&"↓间隔时间↓")
Return
EndIf
If MsgBox(4,"注意!","请核对好已填写的选课列表,是否现在开始选课?") = 7 Then
Return
EndIf
;#################倒计时代码段###########################
If MsgBox(4,"是否定时","是否启用定时刷课功能?否,则现在开始刷课") = 6 Then
Local $n,$m,$o opt('GUIOnEventMode',0) ;切换到消息循环模式
GUICreate("请选择开始时间", 300, 50, 800, 200,BitOR($WS_CAPTION,$WS_POPUP))
$n = GUICtrlCreateDate("", 10, 10, 150, 30)
$DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
$style = "yyyy/MM/dd HH:mm:ss"
GUICtrlSendMsg($n, $DTM_SETFORMAT_, 0, $style)
$m = GUICtrlCreateButton("确定",190,10,40,30)
$o = GUICtrlCreateButton("取消",240,10,40,30)
GUISetState()
While True $msg = GUIGetMsg()
If $msg = $m Then
$endtime = GUICtrlRead($n)
ExitLoop
ElseIf $msg = $o Then
ExitLoop
EndIf
WEnd
GUIDelete() opt('GUIOnEventMode',1) ;根据需要设置会事件模式
$spantime = _DateDiff("s",_NowCalc(),$endtime)
If $spantime < 0 Then
MsgBox(0,'',"时间设置错误!请重试")
Return
EndIf
Local $h,$m,$s
Do
_TicksToTime($spantime*1000,$h,$m,$s)
$t = StringFormat("%02d小时%02d分%02d秒",$h,$m,$s)
GUICtrlSetData($StateShow,'距离开始还有:'&@CRLF&$t)
$spantime -= 1
Sleep(1000)
Until $spantime <= 1
GUICtrlSetData($StateShow,@CRLF&"刷课间隔:"&$reTime&"秒")
$XKxmlhttp.open("GET","http://"&$node&"/隐藏他",False)
$XKxmlhttp.setRequestHeader("Cache-Control","no-cache")
$XKxmlhttp.setRequestHeader("If-Modified-Since", "0")
Do
$XKxmlhttp.send()
Sleep(2000)
Until Not StringRegExp($XKxmlhttp.responsetext,"错误信息",0)
Else
$XKxmlhttp.open("GET","http://"&$node&"/隐藏他",False)
$XKxmlhttp.setRequestHeader("Cache-Control","no-cache")
$XKxmlhttp.setRequestHeader("If-Modified-Since", "0")
$XKxmlhttp.send()
If StringRegExp($XKxmlhttp.responsetext,"错误信息",0) Then
MsgBox(0,"⊙▂⊙","选课入口未开放,不允许选课。"&@CRLF&"请根据服务器时间和开放时间进行选课!")
Return
EndIf
EndIf
;##############################定时刷课代码结束################################# 下面进行其他的处理就可以了!······
endfunc