回复 1# cykefu
是这样意思吗?
#include <Timers.au3>
$Gui = GUICreate("Gui_1")
$Button_1 = GUICtrlCreateButton("Button1", 10, 30, 100)
$Gui_2 = GUICreate("Gui_2", 150, 150, -1, -1, -1, -1, $Gui)
$Button_2 = GUICtrlCreateButton("Button2", 10, 30, 50)
GUISetState(@SW_SHOW, $Gui)
While 1
$msg = GUIGetMsg()
Select
Case $msg = -3
ExitLoop
Case $msg = $Button_1
$TimerDLL = _Timer_SetTimer($Gui_2, 10, "Opos")
GUISetState(@SW_SHOW, $Gui_2)
While 1
$msg2 = GUIGetMsg()
If $msg2 = -3 Then
GUISetState(@SW_HIDE, $Gui_2)
_Timer_KillAllTimers($Gui_2)
ExitLoop
EndIf
WEnd
EndSelect
WEnd
Func Opos($hWnd, $uiMsg, $idEvent, $dwTime)
$CursorInfo = GUIGetCursorInfo()
If $idEvent = $TimerDLL Then
If WinExists($Gui_2) Then
Local $MainWindow = WinGetPos($Gui)
Local $SubWindow = WinGetPos($Gui_2)
WinMove($Gui_2, "", $MainWindow[0] + ($MainWindow[2] / 2) - ($SubWindow[2] / 2), _
$MainWindow[1] + ($MainWindow[3] / 2) - ($SubWindow[3] / 2))
EndIf
EndIf
EndFunc ;==>Opos
|