Prevent Windows from stealing focus

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.