0

There's this annoyance in windows where applications are constantly stealing your focus. I find it very very annoying because I need to work on parallel tasks.

However, I found some registry values that can be updated in windows so that the focus steal is disabled. The problem is that this only works until windows is restarted the next time. After that it reverts back to its default behavior.

How can I ensure that the following keys are updated in windows after every restart (without any manual intervention).

HKEY_CURRENT_USER\Control Panel\Desktop Edit UserPreferenceMask value to be 9F 3E 07 80 12 00 00 00 (there are many numbers in here, I only had to update the 9F 3E 07 parts and the rest of the value remained)

HKEY_CURRENT_USER\Control Panel\Desktop Edit ActiveWndTrkTimeout, change to 150 in decimal

HKEY_CURRENT_USER\Control Panel\Desktop Edit ForegroundFlashCount, change to something like 7000 in decimal

and finally, I set this though from what I read it may/likely not do anything in Windows Vista+ (this was the first thing I tried and it didn't work, but I left it):

HKEY_CURRENT_USER\Control Panel\Desktop Edit ForegroundLockTimeout to something very large (e.g. 9999999 in decimal)

Log off and log back in; so far programs that I KNOW steal focus are silently resting in the background now and flashing me on the taskbar, patiently waiting for me... AHHHHHHHH!

3
  • Create cmd file and put there command reg (run it as reg /? to get info how to use it) with keys you want to update, then put this cmd file in the Startup folder located in C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    – Alex
    Commented Nov 19, 2018 at 15:05
  • @Alex You mean a batch file, right? Also, it's still pretty complicated for me. I'll try searching tomorrow. I'm done for the day.
    – Mugen
    Commented Nov 19, 2018 at 17:03
  • @Alex I tried out your suggestion and spent some time figuring out how to create a bat/cmd file. However, it needs administrator level to make changes to the registry. Any ideas about how to solve that problem?
    – Mugen
    Commented Nov 20, 2018 at 5:10

1 Answer 1

0

I worked on the direction suggested by Alex and arrived at the following solution:

  1. Create .bat file on windows
  2. Enter the following code into the file:

@Echo Off echo 'success' Title Reg Converter v1.2 & Color 1A cd %systemroot%\system32 call :IsAdmin

Reg.exe add "HKCU\Control Panel\Desktop" /v "ActiveWndTrackTimeout" /t REG_DWORD /d "150" /f Reg.exe add "HKCU\Control Panel\Desktop" /v "ForegroundFlashCount" /t REG_DWORD /d "7000" /f Reg.exe add "HKCU\Control Panel\Desktop" /v "ForegroundLockTimeout" /t REG_DWORD /d "9999999" /f Reg.exe add "HKCU\Control Panel\Desktop" /v "UserPreferencesMask" /t REG_BINARY /d "9f3e078012000000" /f Exit

:IsAdmin Reg.exe query "HKU\S-1-5-19\Environment" If Not %ERRORLEVEL% EQU 0 ( Cls & Echo You must have administrator rights to continue ... Pause & Exit ) Cls goto:eof

  1. Add this to Windows Task scheduler to run at startup (Note that adding it to startup causes problems because the script needs admin access).

  2. While creating the Task be sure to check the elevated privileges checkbox

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .