Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sorry for the vague title but this one is hard to explain so bear with me please.

I'm using Windows Vista at work for web development and sometimes when I Click or Alt-Tab to background window, the window will get focus but it will not be brought to the front.

In order to bring the window to the front, I have to click on the applications border (when the resize cursor appears) and the window will then jump to the front.

I've had this problem for about a year now and it happens at least a dozen times a day, but it doesn't do this all the time - seems random.

I hope I have explained the issue fully (and you've understood it) and would appreciate any constructive answers or comments to solve this problem.

Example: If I Alt-Tab from Google Chrome to Notepad and this problem randomly occurs, Google Chrome will remain in front of Notepad, however, I will be able to type text into Notepad while the window is behind Google Chrome. Clicking on Notepad's content area will not bring it to the front but clicking it's window border will.

Video Exampe

http://vimeo.com/19388998

In this video, I clicked from Google Chome to UltraEdit and chrome stayed in font, but as you can see, I can still type in UltraEdit.

I'm starting to believe that this could be a bug in Google Chrome so I'll continue to watch if this between other applications.

share|improve this question
    
Could you set your computer to a lower resolution (HD 720p or less) and upload a video that shows the problem using Jing. Furthermore, try disabling applications that automatically start with Autoruns and ShellExView to see if an idle program or explorer extension is causing this behavior, watch out what you disable though... –  Tom Wijsman Jan 31 '11 at 0:51
    
Does it happen when you have a certain application open in front and try to alt tab from that? It could be a case that that window has been set to always be on top. I had this issue for a little while when my mIRC window was set to always be on top. –  Windos Jan 31 '11 at 0:55
    
I encounter this problem too (using Windows 7). While I don't exactly know the nature of the problem, I think it happens when I have my Web browser opened and there's a flash content on one of the Web sites I got opened. Having said that though, I can't seem to replicate it. –  happy_soil Jan 31 '11 at 3:00
    
Now that I think of it, I got some programs running in the background that are set as "Always on Top", so I think that might be interfering with the window focusing. –  happy_soil Jan 31 '11 at 3:02
    
@happy_soil: You might put this up as an answer. A running "Always on Top" window is a good explanation for this behavior. –  harrymc Jan 31 '11 at 8:42
show 6 more comments

3 Answers

up vote 3 down vote accepted
+100

In the case of Chrome, this is a known issue : Chrome window always-on-top behavior

A quick fix for this problem is to select the Chrome Window and press F11 twice.

share|improve this answer
    
Thanks for the link the this bug, however, it isn't the issue I am having. My problem is related to application windows and not the taskbar. I cannot confirm at this stage if it is Chrome causing this issue or not. –  GateKiller Jan 31 '11 at 13:37
    
I'm sorry if that previous comment sounded rude. It wasn't my intention. I do appreciate your input :) –  GateKiller Jan 31 '11 at 13:41
    
This bug apparently affects both alt-tab and the taskbar. The initial bug report was for the taskbar, but comment 41 also noted its effect upon alt-tab. (and your comment didn't sound rude at all.) –  harrymc Jan 31 '11 at 13:46
    
After further reading and testing I agree that Google Chrome for Windows is indeed the problem. I have added workarounds to your answer while we wait for Google to fix the issue. –  GateKiller Feb 1 '11 at 11:56
    
I highly doubt that these 10 issue reports will be fixed as it dates back from Version 2.0.* in May 16, 2009; and there is no way to reproduce it nor is the source of the problem find. If you want it fixed instead of pressing F11 twice every time you might want to look into more troubleshooting and a solution... –  Tom Wijsman Feb 1 '11 at 14:54
add comment

Got this problem too and find a way to circumvent it. I've installed "Always on Top" software.

And I use it on Chrome for Windows, which changed the state of the property alwaysontop.

share|improve this answer
add comment

What does it look like?

There is only one behavior close to that problem and that would be the Always On Top behavior.
Some piece of code, perhaps from the program itself might be changing the property of your window...

How is a window set to be "Always On Top"?

How To Create a Form That Always Stays on Top shows us that SetWindowPos is called with the second parameter set to HWND_TOPMOST, this immediately places it on top and keeps it that way.

After a quick Google, this result reveals User32.dll to be the owner of this function.

Who sets my window "Always On Top"?

Now that we have the knowledge what function is called, we will want to know when that function is called. This will require us to make stack traces and analyze them, while Windows Performance Toolkit can do this we can be very happy that Rohitab Batra has written the awesome Api Monitor.

Sorry, but this is hard homework:

  • Download API Monitor and install it.
  • Open API Monitor as an administrator, if you have 64 bit, you need to do this twice.
  • Make sure that nothing is checked in API Capture Filter at the left side.
  • In the same place, change All Modules at the top of that Dialog to User32.dll.
  • Go to

    Windows Application UI Development > Windows and Messages > Windows
    

    and then

    User32.dll > SetWindowPos
    

Now, you will want to hook some processes. Word of caution: Sort by PID and do not hook into winlogon.exe or anything that has a lower PID than that, if you do so you will either hang or crash your system. You might experience this behavior with other processes too, but it's kind of like a trial and error to see which ones you can hook. So:

  • Sort by PID, and hook everything that's newer than winlogon.exe.
  • If everything goes well, you can look through the threads in the Hooked Process dialog.
  • Look for an API call that looks like this:

    SetWindowPos ( 0x000000000002043c, HWND_BOTTOM | 0x00000000fffffffe, 0, 0, 0, 0,
    SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE )

A call to SetWindowPos with HWND_BOTTOM | 0x00000000fffffffe (-2 + 1 = -1 = HWND_TOPMOST) is what we are after and the process that does this call is the one you should blame for your problem.

I give up... How can I remedy my "Always On Top" problem?

Battle fire with fire, we're going to set all windows to HWND_NOTOPMOST.

Yikes, programming! But, this can easily be done through scripting too...

So a very simple homework task:

  • Download AutoIt v3.

  • Create a ByeByeTopMost.au3 file that contains:

    While 1
        $var = WinList()
    
        For $i = 1 to $var[0][0]
            WinSetOnTop($var[$i][1], "", 0)
        Next
    
        Sleep(5000)
    WEnd
    
  • Place it in your start-up folder and run it or reboot.

Or if you don't like homework at all, download this zip file I made.

Have fun... :-)

PS: You can't use the "Always On Top" feature in this last case. Either troubleshoot or work-around... ;-)

share|improve this answer
    
I like this answer. –  Kyle Jan 31 '11 at 23:39
    
SetWindowPos is not firing when the problem occurs... I also find it highly offensive that you rename the question completely and then write an answer for it. –  GateKiller Feb 1 '11 at 11:21
    
@GateKiller: How is that offensive? It helps you toward receiving better answers. It's also a more proper description of your problem (as "windows in front" is commonly known as "always-on-top") and now you have changed your title to Google Chrome after receiving answers. Anyhow, you're always free to rollback and I'm glad you had your problem resolved, furthermore SetWindowPos would fire before the problem occurs or another similar procedure that has the same effect could be called... :-) –  Tom Wijsman Feb 1 '11 at 14:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.