找回密码
 加入
搜索
查看: 2348|回复: 6

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

[复制链接]
发表于 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[2][2]=[["{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
 楼主| 发表于 2009-6-19 06:14:33 | 显示全部楼层
没高手指教吗?
发表于 2009-6-19 12:12:33 | 显示全部楼层
If GUICtrlRead($Input1) = "123" Then
        GUIDelete($Form3)
$Form1 = GUICreate("Form1", 191, 51, 192, 124)
 楼主| 发表于 2009-6-20 15:22:40 | 显示全部楼层
谢谢高手指点!
 楼主| 发表于 2009-6-20 15:22:46 | 显示全部楼层
谢谢高手指点!
发表于 2009-6-21 02:01:18 | 显示全部楼层
多看看帮助文件吧,好多在里面都有
GUIDelete ( [窗口句柄] )
窗口句柄 [可选参数] 窗口句柄可由 GUICreate 的返回值获得(默认(default)使用上一次用过的句柄).
发表于 2009-7-24 19:00:02 | 显示全部楼层
本帖最后由 sanmoking 于 2010-1-19 16:07 编辑

楼主应该研究的是怎么在好几个窗口间切换(我指的是多窗口的au3脚本),给你一个参考:
传送门:一个登录工具雏形,里面就有密码正确的话更换窗口的代码,当然更多窗口之间来回切换的部分。关键还是代码的逻辑性。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 23:20 , Processed in 0.082213 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表