#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
;Global $Form0
$Form0 = GUICreate("主窗口", 402, 402, -1, -1)
$Button0 = GUICtrlCreateButton("隐藏子窗", 180, 112, 89, 33);;;;;;;;;;;;;测试按钮
$Form1 = GUICreate("子窗口", 400, 400, 0, 0, $WS_CHILD,0x00C00000,$Form0)
GUISetBkColor(0x99B4D1);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;子窗背景色
$Label1 = GUICtrlCreateLabel("用户名:", 16, 16, 43, 17)
$User = GUICtrlCreateInput("", 72, 16, 169, 21)
GUICtrlSetState(-1, $GUI_FOCUS)
$Label2 = GUICtrlCreateLabel("密码:", 24, 56, 31, 17)
$Password = GUICtrlCreateInput("", 72, 54, 169, 21)
$Button1 = GUICtrlCreateButton("确定", 80, 112, 89, 33)
GUISetState(@SW_SHOW, $Form0)
GUISetState(@SW_SHOW, $Form1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $User
If _IsPressed("0D") Then
MsgBox(0, 0, "按下回车键")
EndIf
GUICtrlSetState($Password, $GUI_FOCUS)
Case $Password
GUICtrlSetState($Button1, $GUI_FOCUS)
Case $Button1
MsgBox(0, 0, GUICtrlRead($User) & @CRLF & GUICtrlRead($Password))
Case $Button0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;测试按钮操作
GUISetState(@SW_HIDE, $Form1)
EndSwitch
WEnd
改回为 -1,则操作正常了!!!!!!!!