Well here's a very very simple one, that shows the concept.
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Global $hMain = GUICreate("Main Window", 400, 600)
Global $hChild = GUICreate("Child Window", 200, 600)
GUIRegisterMsg($WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGING)
GUISetState(@SW_SHOW, $hMain)
GUISetState(@SW_SHOW, $hChild)
WinMove($hMain, "", 0, 0)
While (True)
Switch (GUIGetMsg())
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_WINDOWPOSCHANGING($hWnd, $iMsg, $wParam, $lParam)
Local $tWindowPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam)
Local $iLeft = DllStructGetData($tWindowPos, 3)
Local $iTop = DllStructGetData($tWindowPos, 4)
Local $iWidth = DllStructGetData($tWindowPos, 5)
Local $iHeight = DllStructGetData($tWindowPos, 6)
Local Static $iLastX = 0
Local Static $iLastY = 0
Switch ($hWnd)
Case $hChild
DllStructSetData($tWindowPos, 3, $iLastX)
DllStructSetData($tWindowPos, 4, $iLastY)
Case $hMain
WinMove($hChild, "", $iLeft + $iWidth, $iTop)
$iLastX = $iLeft + $iWidth
$iLastY = $iTop
EndSwitch
EndFunc