Roel Posted September 14, 2009 Posted September 14, 2009 Hi, We've got a popup when there is a new message in a chat. The problem is that when someone is typing in eg Word and there is a message in the chat, Word looses focus. So you have to click in Word before you can type again. Are there solutions, maybe a splash screen or somehting, to avoid this? Thanks!! Roel
jvanegmond Posted September 14, 2009 Posted September 14, 2009 Local $hWndActive = WinGetHandle("[ACTIVE]") ; Store a handle to the currently active window ; Do whatever you do here that loses focus ; I'm going to open notepad Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") If ($hWndActive <> "") Then ; Check if there was a window active in the first place WinActivate($hWndActive) ; Activate that window EndIf Comments describe the solution. ; ) github.com/jvanegmond
smashly Posted September 14, 2009 Posted September 14, 2009 (edited) Hi, another alternative if the popup is an autoit gui.$hGui = GUICreate("Popup", 200, 100) GUISetState(@SW_SHOWNA, $hGui) Do Until GUIGetMsg() = -3 Cheers Edited September 14, 2009 by smashly
Roel Posted September 14, 2009 Author Posted September 14, 2009 (edited) Hi Manadar, The solution you gave is a good solution. However, the program loose for a couple of seconds focus. Is there a solution that the active program will not loose focus at anytime? @Smashly, it is already a gui. Regards, Roel Edited September 14, 2009 by Roel
jvanegmond Posted September 14, 2009 Posted September 14, 2009 (edited) Hi Manadar,The solution you gave is a good solution. However, the program loose for a couple of seconds focus. Is there a solution that the active program will not loose focus at anytime?@Smashly, it is already a gui.Regards,RoelTry Smashly's solution.GUISetState(@SW_SHOWNA, $hGui)@SW_SHOWNA means show GUI but do not activate it.You can also try @SW_SHOWMINNOACTIVE . Edited September 14, 2009 by Manadar github.com/jvanegmond
Roel Posted September 14, 2009 Author Posted September 14, 2009 That is the solution! I didn't see the SHOWNA :-( Thanks! Roel
TurionAltec Posted September 14, 2009 Posted September 14, 2009 Try Smashly's solution.GUISetState(@SW_SHOWNA, $hGui)@SW_SHOWNA means show GUI but do not activate it.You can also try @SW_SHOWMINNOACTIVE .In my opinion it should be standard practice to show a new window but not steal focus.The number of times I've agreed to something, or acknowledged an unknown error when a dialog pops up and steals focus from the Word Processor and started parsing the keyboard input.
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