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.
feedback
|
|
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. | |||||||||||
feedback
|
|
The standard way to disable applications stealing focus is to :
From this point forward, programs should (in theory) no longer steal the focus from the window that you're currently working in. Although this is the documented solution, it may not always work for everybody. Another possibility is 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. [Note: From the comments below, it seems that this registry hack does not apply any more to Windows 7. So I added another answer for Windows 7.] | |||||||||||||||||||||
feedback
|
|
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... | |||||||||||||
feedback
|
|
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 | ||||
|
feedback
|
|
Ghacks has a possible solution:
| |||||
feedback
|
|
Here is another answer, since my previous answer apparently doesn't work for Windows 7. If this is always the same application that is getting the focus, then this application is programmed to take the focus and there is no way to prevent it if the application itself doesn't provide a setting for stopping this behavior. One idea you could try is to minimize this badly-programmed application and hope this way to disable this "feature". Or you could try to minimize it instead to the tray by using one of the free products listed in Best Free Application Minimizer. If you do not know which application is stealing the focus, 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. Another idea would be to fracture your desktop virtually by using a product such as Desktops or Dexpot, and to do your work in another desktop than the default. | |||||||||||||
feedback
|
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.