mjf84 发表于 2009-6-19 05:15:15

密码正确时如何把第一个窗体关闭?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("未完成", 250, 99, 309, 248)
GUICtrlCreateLabel("请输入密码:", 8, 12, 77, 17)
$Input1 = GUICtrlCreateInput("", 8, 32, 233, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("确定(&O)", 86, 64, 75, 25)
$Button2 = GUICtrlCreateButton("取消", 167, 64, 75, 25)
GUICtrlSetLimit($Input1, 100)
Dim $AccelKeys=[["{Enter}", $Input1], ["{Enter}", $Button1]]
GUISetAccelerators($AccelKeys)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $Input1
Button1()
Case $msg = $Button1
       
Case $msg = $Button2
ExitLoop
EndSelect
WEnd
Exit
Func Button1()
If GUICtrlRead($Input1) = "123" Then
$Form1 = GUICreate("Form1", 191, 51, 192, 124)
$in1 = GUICtrlCreateButton("控制面板", 32, 0, 97, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                       
                Case $in1
               Run("control.exe")
                        Exit
        EndSwitch
WEnd
Else
Msgbox(0,"标题","密码错误",3)
Exit
EndIf
EndFunc

mjf84 发表于 2009-6-19 06:14:33

没高手指教吗?

lynfr8 发表于 2009-6-19 12:12:33

If GUICtrlRead($Input1) = "123" Then
        GUIDelete($Form3)
$Form1 = GUICreate("Form1", 191, 51, 192, 124)

mjf84 发表于 2009-6-20 15:22:40

谢谢高手指点!

mjf84 发表于 2009-6-20 15:22:46

谢谢高手指点!

wa18239 发表于 2009-6-21 02:01:18

多看看帮助文件吧,好多在里面都有
GUIDelete ( [窗口句柄] )
窗口句柄 [可选参数] 窗口句柄可由 GUICreate 的返回值获得(默认(default)使用上一次用过的句柄).

sanmoking 发表于 2009-7-24 19:00:02

本帖最后由 sanmoking 于 2010-1-19 16:07 编辑

楼主应该研究的是怎么在好几个窗口间切换(我指的是多窗口的au3脚本),给你一个参考:
传送门:一个登录工具雏形,里面就有密码正确的话更换窗口的代码,当然更多窗口之间来回切换的部分。关键还是代码的逻辑性。
页: [1]
查看完整版本: 密码正确时如何把第一个窗体关闭?