Jump to content

Active program loose focus after autoit popup


Roel
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...