Nov
11
Posted on 2005-11-11
Filed Under (Windows) by Johan Känngård

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_USER\Control Panel\Desktop" /v 
ForegroundFlashCount /t REG_DWORD /d 0x00000000 /f > nul
reg ADD "HKEY_CURRENT_USER\Control Panel\Desktop" /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.

    Read More   

Comments

Stuart Brogden on 5 October, 2007 at 21:02:22 #

I followed this tip and I see an error message for both lines when the batch file executes.


Johan Känngård on 6 October, 2007 at 14:15:38 #

Are you sure you haven’t added a newline after the two /v?


Stuart Brogden on 29 November, 2007 at 02:49:41 #

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.


Timwi on 3 July, 2008 at 18:54:03 #

I think you should have mentioned that this doesn’t work in Windows 2000.


Johan Känngård on 3 July, 2008 at 19:11:20 #

@Timwi I haven’t had Windows 2000 for a number of years, is there perhaps another solution on that old platform?


Styryx on 30 July, 2008 at 13:42:42 #

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


Post a Comment
Name:
Email:
Website:
Comments: