隨手筆記-2
; A simple custom messagebox that uses the OnEvent mode
#include
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $ExitID
_Main()
Func _Main()
Local $YesID, $NoID
GUICreate("Reset TCP/IP @Walter", 270, 80)
GUICtrlCreateLabel(" Press Reset Button To Reinstall TCP/IP", 10, 10)
$YesID = GUICtrlCreateButton("Reset", 30, 50, 80, 20)
GUICtrlSetOnEvent($YesID, "OnYes")
$ExitID = GUICtrlCreateButton("Exit", 140, 50, 50, 20)
GUICtrlSetOnEvent($ExitID, "OnExit")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")
GUISetState() ; display the GUI
While 1
Sleep(1000)
WEnd
EndFunc ;==>_Main
;--------------- Functions ---------------
Func OnYes()
Local $sUserName = "Administrator"
Local $sPassword = "password"
RunAsWait($sUserName, @ComputerName, $sPassword, 2 , "cmd.exe /c netsh int ip reset c:\resetlog.txt ", @SystemDir)
MsgBox(0, "Reboot Request", "Reset OK, Please reboot your computer now.")
EndFunc ;==>OnYes
Func OnExit()
Exit
EndFunc ;==>OnExit
沒有留言:
張貼留言