本帖最后由 3mile 于 2011-5-23 13:03 编辑
回复 8# 131738
借用楼主的问题,请前辈看下这段代码,不知道可不可以解决子窗体闪烁的情况.
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <winapi.au3>
;Global $Form0
$Form0 = GUICreate("主窗口", 402, 402, -1, -1)
$Form1 = GUICreate("子窗口", 400, 400, 0, 0, $WS_CHILD);,0x00000040,$Form0)
$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)
_WinAPI_SetParent($Form1, $Form0)
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))
EndSwitch
WEnd
|