I’ve had a problem for months that defied easy diagnosis and good keywords for Google searches. Simply put, some windows insisted in being in the foreground and anything you opened was forced to the background and you had to minimize or move the ill-behaving programs in order to use the other programs. Didn’t matter if you clicked on the title bar to give it focus, it would have focus but it would still be covered by other programs, likewise if you did an Alt-Tab to switch it.
I FINALLY found a solution!
Since this is Windows, it requires some registry editing. Simply put, look for HKEY_CURRENT_USER\Control Panel\Desktop. There are two keys that we’re interested in: Foreground Flash Count and Foreground Lock timeout. Set the first one to 3 (mine was 7), the second to zero (mine was 200,000 in hex). Then remember to reboot your computer!
This fixed the problem, at least for me.
There’s another suggestion on the page to go in to Control Panel/Ease of Access Center and checking a mouse option that says “Prevent Windows from being automatically arranged when moved to the edge of screen”. When unchecked, in Windows 7, moving a program window in certain ways can result in it maximizing and taking the entire screen. My work system has dual monitors, a 19″ secondary for email and timeclock, and a 24″ primary. I HATE THIS FUNCTIONALITY. I turned it off long ago, and while I appreciate the option, it had nothing to do with my primary problem.
EDIT: this did work briefly, but only briefly. A few days later the z-layer behavior of my windows reverted to its previous idiotic state.