Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Window with 'Focus' won't stay on top of other windows

25 Jun 2015   #11

W7 Pro SP1 64bit

I see this window issue from time to time - so, I'm going to chime in.

Quote   Quote: Originally Posted by Nisko View Post
OK, I looked up the ForegroundFlashCount. The default is 3. My Registry says mine is 0x00000007 (7). I assume that means 7 and my Registry is different from the default. True?
FALSE. The info is wrong in those threads. The technet links posted in both threads are for the Windows 2000 operating system... and yet, the threads are mostly about Windows 7 systems.

From a fresh install of Windows 7 pro 64bit:
Window with 'Focus' won't stay on top of other windows-z.png
ForegroundFlashCount = 7.

In the "" thread, styler918 mentions that ForegroundFlashCount = 7 for windows 7. styler918 is advised to change that to 3. Meghmala never meant to suggest that people change these values to fix the issue. Meghmala meant to tell people to set their values to the default values. Meghmala simply referenced the wrong default values.

The default value for ForegroundLockTimeout is 200 seconds (200000 milliseconds) for both Windows 2000 and Windows 7.

As mentioned, the "" thread just wanted people to compare (and set, if need be) their values to the (wrong) default numbers. The suggestions in the "" thread can get confusing:

On 22 Oct 2011, johnqflorida links to the "" thread.

On 06 Feb 2012, F00DSTAMP proclaims that changing the ForegroundFlashCount to 3 fixed things.

F00DSTAMP came away with the wrong setting and probably did not test long enough to know if the issue was really fixed.

On 22 Aug 2012, BillGateFollower suggests setting ForegroundLockTimeout to 0. Unfortunately, BillGateFollower also quotes the Windows 2000 default for ForegroundFlashCount as being 3.

On 09 July 2013, Eric Miner quotes BillGateFollower's post and says, "All it took was the number 3." Eric Miner makes no mention of setting ForegroundLockTimeout to 0 (which was the point of BillGateFollower's post).

On 02 Jan 2014, krish.badder123 proclaimed that setting ForegroundLockTimeout to 0 fixed the issue for one user profile, but the problem still happened for other users. On that computer, the issue seems to happen quite often.

There are other suggestions that don't make any sense. Some of them fall in the category of "the cure is worse than the disease".

So - what to do? What to change? Why so many different stories about which change fixed things?

Windows are placed on the desktop using X and Y coordinates. The Z axis (Z-order) is used to describe how windows are stacked on top of each other. The Z-order is a simple list - top window to bottom window. The Z-order of windows is handled by the video driver - which are influenced by themes. That Z-order gets messed up - windows get stuck on top - the window in focus is not always on top.

People might make a change in the registry and restart the computer. They might not wait long enough before declaring the issue solved. I don't see this issue every day. Perhaps others see it every few minutes. It probably depends on how messed up their video driver is and how various windows interact with the Z-order (e.g. how the window asks to be on top).

You can change these registry values if you want, but updating the videoDrivers (or maybe changing themes) might set them back to the correct default values. Some people mentioned that their registry changes did not hold.

I need to go ahead and make this post or the image that I attached will be deleted (because the post was not finalized soon enough). I'll ramble on in another post.

...and it happened. The image was deleted. Even hitting the post preview button could not keep that attached image from being deleted. I type too much and too slowly :-(

My System SpecsSystem Spec
25 Jun 2015   #12

Windows 7 Ultimate x64 SP1

Well, changing theme was hinted at one of the suggestions.
Another one that doesn't include changing registry is: toggle taskbar locking
My System SpecsSystem Spec
25 Jun 2015   #13

W7 Pro SP1 64bit

According to the Windows 2000 info, ForegroundFlashCount:
Specifies the number of times the taskbar button flashes to notify the user that the system has activated a background window. If the time elapsed since the last user input exceeds the value of the ForegroundLockTimeout entry, the window will automatically be brought to the foreground.
I'm not sure what activated means in this context. Created?

I'm not sure what system means in this context. Probably the operating system and not the System account.

Do these settings impact how windows act when a user causes a window to open?

Using the default settings for the two registry settings being discussed:
If I tell Task Scheduler to open notepad in a few minutes. Then I leave the computer alone. The notepad window opens behind the window that I used to create the scheduled task.

Changing those two registry values*:
I can get notepad to launch in the foreground.

*without more testing, I'm hesitant to say what the values should be... and besides, I'm not seeing any impact on windows that a user launches - yet.

A scheduled task does seems to qualify as the system activating a background window.
My System SpecsSystem Spec

25 Jun 2015   #14

W7 Pro SP1 64bit

Quote   Quote: Originally Posted by GokAy View Post
Well, changing theme was hinted at one of the suggestions.
Another one that doesn't include changing registry is: toggle taskbar locking
Don't get me wrong, the links were helpful. Changing that one setting from 7 to 3 is not going to hurt anything. Changing themes or toggling various settings might indeed fix the issue (for a while). But it would be nice to know what puts the Windows OS into this broken state.

For what it is worth, Process Monitor did not show those two registry settings being changed during a theme change or toggling the lock on the taskbar. (I did not update/change the videoDrivers.) So much for my theory on why some people's registry edits did not hold. Maybe their security software reverted their registry changes.

Do you ever see the Z-order get messed up?
My System SpecsSystem Spec
25 Jun 2015   #15

Windows 7 Ultimate x64 SP1

If it counts, only sometimes certain pop-up windows stay behind, like auto-play options when inserting a USB flash/drive. Then the icon on taskbar flashes a few times to warn that it has opened, maybe it is the registry setting mentioned that change this behavior?

Any Window that I open myself are correctly come to the front.
My System SpecsSystem Spec
25 Jun 2015   #16

Windows 7

I changed the ForegroundFlashCount value in the Registry from 7 to 3 as the instructions stated. I left the ForegroundLockTimeout the same - as mine was the same as the default. I did this yesterday ans so far, the issue is fixed. I might have to wait for a few days to see if it is fixed for good. In the meantime, thanks for your help I'll let you know the verdict when I get one.
My System SpecsSystem Spec
25 Jun 2015   #17
Microsoft MVP

Vista, Windows7, Mint Mate, Zorin, Windows 8

Have a look whether this little app will help. It is really neat and easy to use ==> DeskPins - Download
My System SpecsSystem Spec

 Window with 'Focus' won't stay on top of other windows

Thread Tools

Similar help and support threads
Thread Forum
how do I get the top-most window to always grab focus?
I just got a new computer and it has Windows 7. Windows 7 is driving me nuts because the top-most window will not automatically get focus. For example, say I have Windows-Explorer and Notepad open. I have Notepad focused and am working in it. I then close Notepad, which leaves Windows-Explorer...
General Discussion
window focus issues (windows 7 pro x64)
when i open a program/window, sometimes it opens in the background instead of the foreground and i have to click the program/window to make it active. sometimes they open as minimized. also, after a restart and a login, i open up internet explorer and the gadgets (clock, calendar, etc) remain on...
General Discussion
window focus with mouse pointer
hi, On one of my computers when the mouse pointer moves to another window the focus automatically goes to that window. But this does not happen on my other machine. Where can I find the setting to do this?i know this is not a big problem it is just that i am not able to resolve it>>> plz help
General Discussion
Windows 7 JavaScript issue window.focus()
Hi I am using Windows 7 and IE8 in my application. I am opening a new pop window using After submit, my request will reload the same opup. While reloading the page is hiding behind the parent window. I have tried using window.focus() to bring the popup front, its not working. This...
Browsers & Mail
window loses focus
For some reason the "focus" goes away from the page I'm on and my cursor disappears Whether it's in Word on the Internet etc. I can click back on the page and it reappears. The "title" bar lightens up so the focus must be going to another program. It happens no matter what I'm looking at. Hide...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 05:20.
Twitter Facebook Google+