jdelaney Posted October 11, 2012 Share Posted October 11, 2012 When I create the second window, it's displayed behind the parent window's controls. Any suggestions to bring it to the front? #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hwndGUI = GUICreate ( "test" ) $hControl = GUICtrlCreateGroup ( "test", 0,0,100, 100 ) $Child_GUI = GUICreate("Child", 200, 100, 10, 50, bitor( $WS_OVERLAPPEDWINDOW,$WS_CHILD, $WS_EX_TOPMOST),-1 , $hwndGUI) GUISetState(@SW_SHOW, $hwndGUI) GUISetState(@SW_SHOW, $Child_GUI) GUICtrlCreateButton('SecondguiButton', 0, 0) GUICtrlSetState($Child_GUI,$GUI_ONTOP ) GUICtrlSetState($Child_GUI,$GUI_SHOW ) WinActivate ( $Child_GUI ) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete ( $Child_GUI ) ExitLoop EndSwitch WEnd IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
StringingLong Posted October 14, 2012 Share Posted October 14, 2012 (edited) You need to explain exactly what you are trying to accomplish here. Looking at your code, I cant tell if you want separate windows, the child window to be part of the group box, or whatever. If you want two separate windows side by side do it like this: #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hWnd1 = GUICreate("Window 1", 200, 200, 100, 100, BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER, $WS_VISIBLE)) $hWnd2 = GUICreate("Window 2", 200, 200, 350, 100, BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER, $WS_VISIBLE)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hWnd1) GUIDelete($hWnd2) ExitLoop EndSwitch WEnd If you want $hWnd2 to be a child within $hWnd1 do it like this: #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hWnd1 = GUICreate("Window 1", 200, 200, 100, 100, BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER, $WS_VISIBLE)) $hWnd2 = GUICreate("Window 2", 100, 100, 20, 20, BitOR($WS_CHILD, $WS_BORDER, $WS_VISIBLE),-1,$hWnd1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hWnd1) ExitLoop EndSwitch WEnd If you want the child window to be a child of the group box, and the group box to be a child of the main window do this: #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hWnd1 = GUICreate("Window 1", 200, 200, 100, 100, BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER, $WS_VISIBLE)) $idGroupBox = GUICtrlCreateGroup(" My Group ", 10,10,160,160) $hWndGroupbox = _WinAPI_GetDlgItem($hWnd1, $idGroupBox) $hWnd2 = GUICreate("", 100, 100, 20, 20, BitOR($WS_CHILD, $WS_BORDER, $WS_VISIBLE),-1,$hWndGroupbox) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hWnd1) ExitLoop EndSwitch WEnd Edited October 14, 2012 by StringingLong Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now