Jump to content

Recommended Posts

Posted

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

Posted

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. ; )

Posted (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 by Roel
Posted (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

Try Smashly's solution.

GUISetState(@SW_SHOWNA, $hGui)

@SW_SHOWNA means show GUI but do not activate it.

You can also try @SW_SHOWMINNOACTIVE .

Edited by Manadar
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...