I want to be able to work in the program I have open at the moment, and not being interrupted by other applications that want automatic focus. So I have used TweakUI quite a while. The problem is that some applications tend to overwrite the crucial registry settings with their own (read: steal focus ON).
To get around this, I now have a BAT file that is run whenever I log in:
@echo off
reg ADD "HKEY_CURRENT_USERControl PanelDesktop" /v
ForegroundFlashCount /t REG_DWORD /d 0x00000000 /f > nul
reg ADD "HKEY_CURRENT_USERControl PanelDesktop" /v
ForegroundLockTimeout /t REG_DWORD /d 0x00030d40 /f > nul
Note that there shouldn’t be a newline after the /v’s…
Put a shortcut to the BAT file in your Startup folder in the Start menu, and it will silently run whenever you login.
Thanks to Adrian that made me (and others?) aware of the reg command. This way, I don’t have to use a .REG file.
I followed this tip and I see an error message for both lines when the batch file executes.
Are you sure you haven’t added a newline after the two /v?
Johan – thanks for the kindness of your reply. I just now saw it. I may have in fact made the very error you warn against, as I re-created a batch file just now taking care of that new line trap and it seems to be working.
I think you should have mentioned that this doesn’t work in Windows 2000.
@Timwi I haven’t had Windows 2000 for a number of years, is there perhaps another solution on that old platform?
Maybe you can also prevent any application of changing these values, when you disable himself the right to write in this registry key (it can be done using registry editor, setting key Permissions). Of course, there is then the problem, that you cannot change anything under this key, so you e.g. will not be able to change desktop wallpaper (but in such case, you can re-enable the permission for a while).
The same can be e.g. done for the Run key (no application will be then able to add itself to auto-start with login – quite good defence against viruses).
[…] Känngård has a short article where he describes a program he wrote to set the proper setting every time he logs in – to foil […]