Krass Posted September 13, 2005 Posted September 13, 2005 hi how can I force the mainwindow back to the foreground after closing request windows ? I found this .. uhm.. bug (?) ... with the funktion "FileOpenDialog" - after using this funktion (and closing it) my mainwindow is behind every other window on the screen..... same thing happend with msgbox. I tried GUISwitch($MainWindow) and GUISetState(@SW_SHOW) - nothing happends. I also tried it with the compiled .exe file - same here can anyone help me pls ? my versions: SciTE4AutoIt3 8/30/2005 AutoIt v3.1.1 7/4/2005 here is a small example with a MsgBox: #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) $MainWindow = GuiCreate("Test", 200, 200, 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitMacro") GUICtrlCreateButton("MSG", 30, 30, 80, 20) GUICtrlSetOnEvent(-1, "ShowInfo") ;---------------------------- GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit ;---------------------------- func ExitMacro() Exit endfunc func ShowInfo() GuiSetState(@SW_DISABLE ,$MainWindow) MsgBox(1,"Question","Why is the main into the backgroud when this box is closed ?") GuiSetState(@SW_ENABLE ,$MainWindow) GUISwitch($MainWindow);hmmm GUISetState(@SW_SHOW);hmmmmmmm EndFunc
JoshDB Posted September 13, 2005 Posted September 13, 2005 Have you tried WinActivate or WinSetOnTop? Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
AutoChris Posted September 13, 2005 Posted September 13, 2005 Try this code and see if it works better for you: #include <GuiConstants.au3> $MainWindow = GuiCreate("Test", 200, 200, 200, 200) $MainButton = GUICtrlCreateButton ("MSG", 30, 30, 80, 20) GuiSetState () While 1 $msg = GuiGetMsg () Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $MainButton GUISetState (@SW_Hide, $MainWindow) MsgBox(1,"Question","Why is the main into the backgroud when this box is closed ?") GUISetState (@SW_SHOW, $MainWindow) Case Else EndSelect WEnd Exit
Krass Posted September 13, 2005 Author Posted September 13, 2005 (edited) @JoshDB thanks a lot ! I didn't saw (ignored) the WinXXX command (/slap myself) it's so easy thx again *edit:* WinActivate ("Test") at the end of the function ShowInfo worked @SerialKiller also thanks, you gave me a nice idea ! well it's funny but I could use both solutions in my macro Edited September 13, 2005 by Krass
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