Are there any solutions to prevent applications stealing focus from the active window?
This is especially annoying when I'm starting an application, switch to do something else and the new application starts receiving half a sentence of text.
|show 6 more comments|
There is an option in TweakUI which does this. It prevents most of the usual tricks dubious software developers employ to force focus on their app.
It's an ongoing arms war though, so I don't know if it works for everything.
Update: According to EndangeredMassa, TweakUI does not work on Windows 7.
|show 1 more comment|
A while ago I've done extensive research on solving this issue once and for all (and failed). The result of my research can be found on the annoyance project page.
The project also includes an application that repeatedly tries to grab focus by calling:
As we can see from this snippet, my research was also focused on other aspects of user interface behavior I don't like.
The way I tried to solve this was to load a DLL into every new process and hook the API calls that cause another windows to be activated.
From my tests back then, this worked great. Except for the part of loading the DLL into every new process. As one might imagine, that's nothing to take too lightly. I used the AppInit_DLLs approach back then (which is simply not sufficient).
Basically, this works great. But I never found the time to write something that properly injects my DLL into new processes. And the time invested in this largely overshadows the annoyance the focus stealing causes me.
In addition to the DLL injection problem, there is also a focus stealing method which I didn't cover in the implementation on Google Code. A co-worker actually did some additional research and covered that method. The problem was discussed on SO: http://stackoverflow.com/questions/7430864/windows-7-prevent-application-from-losing-focus
In Windows 7, the
However, the documentation sucks and they chase each other and find ways around that.
So, there is something buggy going on with
The only way to really do this properly is to make a small application which periodically calls
If that's not enough (another buggy API call?) you can go even further and do some API monitoring to see what's going on, and then you simply hook the API calls on every process after which you can get rid of any calls that mess up the foreground. However, ironically, this is discouraged by Microsoft...
|show 9 more comments|
I believe that some confusion may exist, as there are two ways of "stealing focus" : (1) a window coming to the foreground, and (2) the window receiving keystrokes.
The problem referred to here is probably the second one, where a windows claims the focus by bringing itself to the foreground - without the user's request or permission.
The discussion must split here between XP and 7.
In XP there is a registry hack that makes XP work the same as Windows 7 in preventing applications from stealing focus :
(The discussion below mostly applies to XP as well.)
Please understand that there is no way in which Windows can totally block applications from stealing the focus and remain functional. For example, if during a file-copy your anti-virus detected a possible threat and would like to pop-up a window asking you for the action to take, if this window is blocked then you would never understand why the copy never terminates.
In Windows 7 there is only one modification possible to the behavior of Windows itself, which is
to use the MS-Windows focus-follows-mouse Registry hacks, where the focus and/or activation goes always to the windows under the cursor. A delay can be added to avoid applications popping up all over the desktop.
Otherwise, one must detect and neutralize the guilty program : If this is always the same application that is getting the focus, then this application is programmed to take the focus and preventing this may be done by either disabling it from starting with the computer, or use some setting supplied by that application to avoid this behavior.
You could use the VBS script included in VB Code which identifies who's stealing focus, which the author used to identify the culprit as a "call home" updater for a printer software.
A desperate measure when all else fails, and if you have identified this badly-programmed application, is to minimize it and hope that will not then bring itself to the front. A stronger form of minimization is to the tray by using one of the free products listed in Best Free Application Minimizer.
|show 2 more comments|
Ghacks has a possible solution:
PowerMenu will do waht you want to do in windows 7. I have Windows-7 32 bit so don't know it will work on 64 bit properly or not. But on my version its working like a charm for me. After installing this just right click on the top of window and select the option you want to.
And select the
OK I got it!
You can use these two more programs which are easy to use. Always on Top will work good just you have to launch it after installing it and then just drag the hand button to the desired app to make it on top always and you can toggle it through the Ctrl+F8 and lose focus from active windows you can use Ctrl+Spacebar.
Second tool is the Deskpin just install it and then click on the pin icon in the taskbar tray icon and then click it on the windows top which you want to keep on top.
|show 1 more comment|
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?