Tomb Posted February 22, 2008 Share Posted February 22, 2008 Is there any way i can have my main GUI always have focus, so child windows cannot steal focus from it? If my child GUI moves or anything, my main GUI loses focus and i want it to always have focus, or at least always seem to have focus. I really just want the bar above my GUI to always be seen like it was the GUI with focus, that way when the child GUI's move the main GUI seems still on top. Link to comment Share on other sites More sharing options...
Achilles Posted February 22, 2008 Share Posted February 22, 2008 Would GuiSetState(@SW_DISABLE) help? That means you can't click anything on the GUI so I'm not sure if that's what you need... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Tomb Posted February 22, 2008 Author Share Posted February 22, 2008 Would GuiSetState(@SW_DISABLE) help? That means you can't click anything on the GUI so I'm not sure if that's what you need...i tried but focus is still removed from the main GUI. i am trying to use something with WinActivate, but you still see the main GUI lose focus for a second. Link to comment Share on other sites More sharing options...
Tomb Posted February 25, 2008 Author Share Posted February 25, 2008 Is there any way i can have my main GUI always have focus, so child windows cannot steal focus from it? If my child GUI moves or anything, my main GUI loses focus and i want it to always have focus, or at least always seem to have focus. I really just want the bar above my GUI to always be seen like it was the GUI with focus, that way when the child GUI's move the main GUI seems still on top.well its been several days, and i don't like doing this but i guess i can bump my thread. Link to comment Share on other sites More sharing options...
Siao Posted February 25, 2008 Share Posted February 25, 2008 "On top" and "focused" are two different things. Only one window can have focus at a time. If the user activates and is interacting with a window, it has focus. If it doesn't have focus, the user can't interact with it. Why do you want to go against this fundamental behaviour of operating system, and how do you imagine it working out? You can switch focus back to whatever window you want whenever you want though, if you're sure it's sensible doing so. For example, catch WM_EXITSIZEMOVE message of some child window(s) and activate the parent window. Otherwise, post example of what you are trying to do or what you want it to do. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Tomb Posted February 26, 2008 Author Share Posted February 26, 2008 "On top" and "focused" are two different things. Only one window can have focus at a time. If the user activates and is interacting with a window, it has focus. If it doesn't have focus, the user can't interact with it. Why do you want to go against this fundamental behaviour of operating system, and how do you imagine it working out? You can switch focus back to whatever window you want whenever you want though, if you're sure it's sensible doing so. For example, catch WM_EXITSIZEMOVE message of some child window(s) and activate the parent window. Otherwise, post example of what you are trying to do or what you want it to do.i think i just want it so that when i GuiSetState(@SW_SHOW) a GUI, i want the previous GUI to still have focus. each time it steals focus, and in this case i don't want it to. i want focus to remain on the main GUI until i click on the other one. the other one is a child GUI to the main one. Link to comment Share on other sites More sharing options...
Siao Posted February 26, 2008 Share Posted February 26, 2008 (edited) Show that GUI using API: _WinAPI_ShowWindow($hWnd, 4) or _WinAPI_SetWindowPos($hWnd, 0, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOREPOSITION, $SWP_NOSIZE, $SWP_NOZORDER, $SWP_SHOWWINDOW)) Edited February 26, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Tomb Posted February 26, 2008 Author Share Posted February 26, 2008 (edited) Show that GUI using API: _WinAPI_ShowWindow($hWnd, 4) or _WinAPI_SetWindowPos($hWnd, 0, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOREPOSITION, $SWP_NOSIZE, $SWP_NOZORDER, $SWP_SHOWWINDOW))YOU ARE MY HERO! that has been making me crazy for 2 months. thank you in all of my time using autoit, i have never used these winAPI functions, but they are very amazing Edited February 26, 2008 by Tomb616 Link to comment Share on other sites More sharing options...
Siao Posted February 27, 2008 Share Posted February 27, 2008 (edited) Eh, just tried and noticed that GuiSetState accepts SW_SHOWNOACTIVATE flag too, even if it's not explicitly documented as one of possible flag values for it. So just GuiSetState(@SW_SHOWNOACTIVATE) will do the trick, no need for WinAPI.au3 Edited February 27, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Tomb Posted February 27, 2008 Author Share Posted February 27, 2008 (edited) Eh, just tried and noticed that GuiSetState accepts SW_SHOWNOACTIVATE flag too, even if it's not explicitly documented as one of possible flag values for it.So just GuiSetState(@SW_SHOWNOACTIVATE) will do the trick, no need for WinAPI.au3THAT IS EVEN BETTER! Edited December 9, 2012 by Tomb 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