本帖最后由 beyotang 于 2017-6-13 12:52 编辑
因为行业的原因,必须在这个教育网上在线学习,所以弄了这么个东西来挂机。挂机代码现在没问题了,唯独退出键不生效,只能在托盘图标点右键退出,请大神帮忙改改。新手不太懂,也没有编程经验。#include <ie.au3>
Global $Url = "http://zyjsry.mypx.org/index.asp"
Global $Url2 = "http://zyjsry.mypx.org/Learn_show.asp?ID=327"
Global $BackURL
Global $login_IE = _IECreateEmbedded ()
Global $login_gui = GUICreate("内嵌IE不弹出新窗口" , 930, 565)
Global $login_GUIActiveX = GUICtrlCreateObj($login_IE, 10, 10, 910, 440)
Global $Btn_Back = GUICtrlCreateButton("返回", 120, 480, 100, 70)
Global $Buttonx = GUICtrlCreateButton("退出", 650, 480, 100, 70)
$EventObject2 = ObjEvent($login_IE, "IEEvent_", "DWebBrowserEvents2") ;注册获取 IE对象产生的事件,有事件则调用后面的相关函数
GUISetState()
login()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
$EventObject2 = 0
Exit
Case $Buttonx
$EventObject2 = 0
Exit
Case $Btn_Back
$login_IE.Navigate($BackURL)
EndSwitch
WEnd
Volatile Func IEEvent_NewWindow3($ppDisp, ByRef $Cancel, $dwFlags, $bstrUrlContext, $bstrUrl)
$BackURL = $bstrUrlContext
$Cancel = True
$login_IE.Navigate( $bstrUrl )
EndFunc
Func login()
$login_IE.Navigate($Url)
_IELoadWait($login_IE)
$user = _IEGetObjByName($login_IE, "name")
$user.value = '赵明'
$pw = _IEGetObjByName($login_IE, "codenum")
$pw.value = '88888888888888'
$Submit = _IEGetObjByName($login_IE, "imageField")
Sleep(800)
$Submit.click
Sleep(5000)
_IELoadWait($login_IE)
$login_IE.Navigate($Url2)
Sleep(1680000)
EndFunc
|