#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 100, 100, 242, 174)
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUIRegisterMsg($WM_SIZE, "MY_MOVE")
GUISetState(@SW_SHOW)
$Form2 = GUICreate("Form2", 294, 164, 192, 124)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
$XY = WinGetPos($Form1)
$XY2 = WinGetPos($Form2)
WinMove($Form1, "", $XY2[0]+50, $XY2[1]+50)
WinSetOnTop('Form1','',1)
EndFunc
|