【已解决】主窗口 点关于按钮 点确定后 关闭关于 返回主窗口 该如何写脚本?
本帖最后由 mshuking 于 2015-1-8 15:49 编辑主窗口 点关于按钮 点确定后 关闭关于 返回主窗口 该如何写脚本?#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Button1 = GUICtrlCreateButton("关于", 184, 184, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("关于", 338, 249, 302, 218)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
$Image1 = GUICtrlCreatePic("C:\Windows\Web\Wallpaper\Windows\img0.jpg", 16, 24, 105, 97)
$Label1 = GUICtrlCreateLabel("产品名称", 152, 24, 52, 17)
$Label2 = GUICtrlCreateLabel("版本", 152, 48, 28, 17)
$Label4 = GUICtrlCreateLabel("备注", 16, 160, 28, 17)
$Label3 = GUICtrlCreateLabel("版权", 16, 136, 28, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("确定(&O)", 124, 208, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 2
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE , $Button2
Exit
EndSwitch
WEnd
EndSwitch
WEnd非常感谢#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
_ping()
$oIE = _IECreateEmbedded ()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("网络验证", 221, 89)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 1, 1, 1) ;网络验证控件
$Button1 = GUICtrlCreateButton("网络验证测试", 72, 32, 84, 25)
$Button2 = GUICtrlCreateButton("测试", 72, 64, 84, 25)
GUISetState(@SW_SHOW)
GUICtrlSetState($Button1, $GUI_DISABLE);未验证前,禁止控件。
GUICtrlSetState($Button2, $GUI_DISABLE);未验证前,禁止控件。
#EndRegion ### END Koda GUI section ###
Global $yz
_IENavigate ($oIE, "http://hi.baidu.com/jjigwfowwkbdjtd/item/9cc6544d9df61595823ae1e7")
$html = _IEDocReadHTML($oIE)
$html=StringReplace($html,'"',"")
$html = _find_value($html,'<div id=m_blog class=modbox style=overflow-x:hidden;>',1,'<div class=opt id=blogOpt>')
$yz = _find_value($html,'<p>',1,'</p>')
$yz = _find_value($html,'<p>',2,'</p>')
$yz = _find_value($html,'<p>',3,'</p>')
$yz = _find_value($html,'<p>',4,'</p>')
;可以根据自己需要自己添加
$bb = "1.0"
If $yz = $bb Then
;MsgBox(64,"更新提示","当前版本为:"& $bb & @CRLF &"新版本为:"&$yz& @CRLF & "当前是最新版本,无须更新!")
ElseIf $yz <> $bb Then
MsgBox(64,"更新提示","当前版本为:"&$bb& @CRLF &"新版本为:"& $yz & @CRLF & $yz & @CRLF & $yz)
Exit
EndIf
GUICtrlSetState($Button1, $GUI_ENABLE);验证通过,激活控件。
GUICtrlSetState($Button2, $GUI_ENABLE);验证通过,激活控件。
GUICtrlSetData($Button1,"网络验证通过")
GUICtrlSetData($Button2,"通过")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _find_value($or_testtxt,$key1,$key1_no,$key2)
$position1=StringInStr($or_testtxt,$key1,0,$key1_no)+StringLen($key1)
If $position1 Then
$textlen=StringInStr($or_testtxt,$key2,0,1,$position1)-$position1
$testtxt=StringMid($or_testtxt,$position1,$textlen)
$testtxt=StringStripWS($testtxt,3)
Else
$testtxt=""
EndIf
Return $testtxt
EndFunc
Func _ping()
Local $var = Ping("www.baidu.com")
If $var Then
Else
MsgBox(64,"警告!","软件出现一个错误,错误代码: "& @error & @CRLF & @CRLF & "请检查您的网络连接,或联系作者。")
Exit
EndIf
EndFunc 回复 1# mshuking
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Button1 = GUICtrlCreateButton("关于", 184, 184, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("关于", 338, 249, 302, 218)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
$Image1 = GUICtrlCreatePic("C:\Windows\Web\Wallpaper\Windows\img0.jpg", 16, 24, 105, 97)
$Label1 = GUICtrlCreateLabel("产品名称", 152, 24, 52, 17)
$Label2 = GUICtrlCreateLabel("版本", 152, 48, 28, 17)
$Label4 = GUICtrlCreateLabel("备注", 16, 160, 28, 17)
$Label3 = GUICtrlCreateLabel("版权", 16, 136, 28, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("确定(&O)", 124, 208, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 2
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
GUISetState(@SW_HIDE,$Form2)
GUISetState(@SW_SHOW,$Form1)
EndSwitch
WEnd
EndSwitch
WEnd 33行exit改为以下 GUIDelete($Form2)
ExitLoop #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#region ### START Koda GUI section ### Form=
Dim $Form2
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
$Button1 = GUICtrlCreateButton("关于", 184, 184, 75, 25)
GUICtrlSetOnEvent(-1, "gy")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
WEnd
Func gy()
#region ### START Koda GUI section ### Form=
$Form2 = GUICreate("关于", 338, 249, 302, 218, -1, -1, $Form1)
GUISetOnEvent($GUI_EVENT_CLOSE, "gy_close")
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
$Image1 = GUICtrlCreatePic("C:\Windows\Web\Wallpaper\Windows\img0.jpg", 16, 24, 105, 97)
$Label1 = GUICtrlCreateLabel("产品名称", 152, 24, 52, 17)
$Label2 = GUICtrlCreateLabel("版本", 152, 48, 28, 17)
$Label4 = GUICtrlCreateLabel("备注", 16, 160, 28, 17)
$Label3 = GUICtrlCreateLabel("版权", 16, 136, 28, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("确定(&O)", 124, 208, 75, 25, 0)
GUICtrlSetOnEvent(-1, "gy_close")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
EndFunc ;==>gy
Func gy_close()
GUIDelete($Form2)
EndFunc ;==>gy_close
Func _Exit()
Exit
EndFunc ;==>_Exit #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438)
$Button1 = GUICtrlCreateButton("关于", 184, 184, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
gy()
EndSwitch
WEnd
Func gy()
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("关于", 338, 249)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
$Image1 = GUICtrlCreatePic("C:\Windows\Web\Wallpaper\Windows\img0.jpg", 16, 24, 105, 97)
$Label1 = GUICtrlCreateLabel("产品名称", 152, 24, 52, 17)
$Label2 = GUICtrlCreateLabel("版本", 152, 48, 28, 17)
$Label4 = GUICtrlCreateLabel("备注", 16, 160, 28, 17)
$Label3 = GUICtrlCreateLabel("版权", 16, 136, 28, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("确定(&O)", 124, 208, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 2
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE , $Button2
GUIDelete($Form2)
ExitLoop
EndSwitch
WEnd
EndFunc 谢谢 非常感谢 感谢分享,学习了··
页:
[1]