; GUI_GUI.au3 V00.00.01 6 Mar 2017 08:50 #include #include #include #include #include #include $Main_GUI = GUICreate("Main", 500, 500) GUISetBkColor(0x1B5583, $Main_GUI) ; GUISetState(@SW_SHOW, $Main_GUI) $Child1_GUI = GUICreate("ExitGUI", 480, 480, 10, 10, $WS_CHILD, -1, $Main_GUI) $Btn_Exit = GUICtrlCreateButton("E&xit", -1, -1, 90, 20) ; note "&" syntax! Underscores next char GUICtrlSetColor($Btn_Exit, $COLOR_RED) ; sets text colour ; this displays the 'master' GUI.. GUISetState(@SW_SHOW, $Child1_GUI) ; this sets up the 'child' GUI.. $Child2_GUI = GUICreate("Child", 200, 100, 10, 50, $WS_CAPTION) GUISetBkColor(0xfffaf0, $Child2_GUI) $Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20) ; this displays the 'child' GUI but not yet positioned... GUISetState(@SW_SHOW, $Child2_GUI) ; this puts the 'child' GUI within 'master' GUI... DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child2_GUI), "hwnd", WinGetHandle($Child1_GUI)) ;sleep(5000) ;Exit While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ;, $Btn_Exit ;not work without $Btn_Exit defined! Exit Case $Btn_Test MsgBox(0, "Test", "Hit Button on Child Window") EndSwitch WEnd