windowswinapiwindows-10windows-11setforegroundwindow

SetForegroundWindow: relationship between the ForegroundLockTimeout registry value and the SPI_GETFOREGROUNDLOCKTIMEOUT WinAPI parameter


Context:


It seems that the SPI_GETFOREGROUNDLOCKTIMEOUT / SPI_SETFOREGROUNDLOCKTIMEOUT values used with the SystemParametersInfo WinAPI function correspond to the ForegroundLockTimeout persistent, per-user registry value (in HKEY_CURRENT_USER\Control Panel\Desktop).
The foreground-lock timeout is the period of time following interactive user input during which cross-process window activation is not permitted.

My expectation is as follows:

This expectation is not met in the following cases:

My questions:


Solution


  • [1] This value in milliseconds amounts to a duration of 24+ days(!) of the system having to be idle (in terms of user input) before a non-foreground process is allowed to activate another window, which in effect amounts to disabling such activations.