Alt+Tab Bug Worsened by IE 10, But Fix Found

Windows 7 has an annoying bug that causes alt+tab to malfunction for many people. This bug, previously discussed on this blog in Alt+Tab Depth Inversion Bug, causes the grid of programs to be partially or completely hidden, making it much harder to switch between programs. IE 10 adds to the ways of triggering this bug, making it harder to avoid than ever before.

On the bright side, working around other people’s bugs is one of my hobbies, and IE 10’s triggering of this bug pushed me to create a fix.

So now this bug can be banished forever, without upgrading to Windows 8, and without waiting for a fix from Microsoft. See the end for a link to the fix.

Update, the update again, November 2013: I reported that IE 10 was triggering this bug to Microsoft but they decided not to fix IE 10. I thought they had fixed IE 11, so I upgraded. I didn’t see the bug for a couple of days, but it is still there. Sigh…

(see Other Causes of Alt+Tab Problems for more details)

New causes

imageThe original bug was typically triggered by ipoint.exe or sidebar.exe. ipoint.exe is the Microsoft Intellipoint software, and sidebar.exe maintains the Windows gadgets, such as the clock. If either of these programs is running in Windows 7 then the bug may occur. The original ‘fix’ was to make sure that neither of these programs was running, and this worked quite well for me for four years.

And then, a few months ago, the bug came back – intermittently. It took a bit of observation and experimentation but eventually I found the cause. If you have IE 10 installed on Windows 7 and if you drag an Internet Explorer tab out of its window in order to create a new top-level IE window (tearing off a tab) then this bug may be triggered. I find this annoying because while it was no great sacrifice to never run ipoint.exe and sidebar.exe (I don’t know what ipoint.exe does and I have no interest in what sidebar.exe does), I do find tearing off tabs to be useful. So it was time to start investigating.

Research

There was a long-standing theory in the alt+tab conspiracy newsgroups that this bug was triggered by the presence of windows of a particular type. Therefore I started by writing some code that built a list of top-level windows using EnumWindows, then waited a few seconds, and then did it again. On the second pass the code printed all of the newly created windows. By running this program and then triggering the bug before the second pass I could see what new windows were created. There were quite a few, and the problem then became to sort out the interesting from the banal.

I focused on the window styles, obtained with a couple of calls to GetWindowLong:

LONG style = GetWindowLong(hwnd, GWL_STYLE);
LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);

A bit of experimentation and staring at hexadecimal representations of window styles made me suspect that always-on-top windows (WS_EX_TOPMOST) were relevant. These are windows that have a flag that says that they should be on top of all ‘normal’ windows.

However my system contained quite a few always-on-top windows, so that clearly wasn’t enough. More playing around led me to notice a few common attributes. In all situations where the bug appeared there was a new window that was:

  1. Always-on-top (WS_EX_TOPMOST)
  2. Visible (WS_VISIBLE)
  3. Owned by ipoint.exe, sidebar.exe, or iexplore.exe
  4. Zero size and located at 0,0

With these factors identified I modified my code so that when it detected a window that fit these four attributes it would clear the WS_VISIBLE flag:

SetWindowLong(hwnd, GWL_STYLE, style & ~WS_VISIBLE);

And the bug went away! This simple fix – clearing a flag from these particular windows – fixes all known instances of this bug.

Celebration!

Changing the window styles of a window owned by another program is rude. It’s bad behavior. But, the idea of an always-on-top, visible, zero-sized window is illogical and, apparently, problematic, so I assuaged my conscience with something about the needs of the many users outweighing the needs of a few windows, and called it good.

The only remaining thing to do was to wrap this into a useful general purpose tool. I made the executive decision to fix all windows that had attributes 1, 2, and 4, regardless of what process they were owned by. I also decided to create a variation of the fixer tool that hangs around and runs the fix-it process every time the user presses tab.

The net effect is that if you run Cygnus Software’s Super Alt+Tab Fix-it Magic Ronco Latenight Infomercial Madness AltTabFixContinuous.exe then the bug should go away. Every time you type Alt+Tab (or, you know, just ‘tab’) any malformed windows are fixed before they can cause pain and suffering. Put this (did I mention it’s free!) program in your startup folder and this bug should (no warranty implied) go away.

You can also test it out with less of a commitment by running AltTabFixOnce.exe. This runs the fix-it process just once, and prints out the results so that you can see what it found and what it did.

Bad advice

In the answers.microsoft.com discussion there are many suggestions about how to deal with this bug and I’d like to respond to some of them here:

  • Turn off Aero Peek – this works, I guess, but turning off a feature hardly counts as fixing it
  • Check which version of Windows 7 you are running – this doesn’t matter, all versions are vulnerable
  • Update your display drivers – if this helps at all it is pure luck because the bug is not related to display drivers

The bug is in Windows Explorer. The Windows 7 version of Windows Explorer apparently doesn’t handle always-on-top windows very well.

In closing

imageThe programs that create zero-sized always-on-top windows should stop doing that. It’s just weird. But really, explorer should be able to handle it. In Windows 8 explorer appears to have been fixed in order to avoid this bug.

I’m not thrilled about having written this program. On the upside, I’m pleased to have the skills needed to identify the factors that cause this bug, and the time to create a tool that will automatically remove those factors. On the downside, what a waste of time. The bug has been known for years and it probably affects millions of people (a large and increasing percentage of Windows 7 users who use Alt+Tab). I really wish Microsoft would fix these fit-and-finish bugs, rather than hoping that customers upgrade to Windows 8. As a Microsoft stockholder I really wish that they would make make their products a delight to use. Maybe now that IE 10 is making the bug show up more frequently they will feel obliged to fix it – or at least fix IE 10 so that it doesn’t trigger the bug.

I have passed all of this information along to my informal contacts at Microsoft.

In short, if you are currently experiencing this bug and you want to test my fix, run AltTabFixOnce.exe, look at the output, and see if it works. If the fix appears to work and you want to be rid of this scourge forever then copy AltTabFixContinuous to your startup folder. Both programs, and their source code, are available here. That is all.

Resources

About brucedawson

I'm a programmer, working for Google, focusing on optimization and reliability. Nothing's more fun than making code run 10x as fast. Unless it's eliminating large numbers of bugs. I also unicycle. And play (ice) hockey. And sled hockey. And juggle. And worry about whether this blog should have been called randomutf-8. 2010s in review tells more: https://twitter.com/BruceDawson0xB/status/1212101533015298048
This entry was posted in Bugs, Computers and Internet, Investigative Reporting and tagged , . Bookmark the permalink.

64 Responses to Alt+Tab Bug Worsened by IE 10, But Fix Found

  1. jladams97 says:

    Amazing! It appears to do the trick for me. I’m an ipoint user (you mention that you don’t know what it does: if you have a Microsoft mouse, it gives it much greater configurability than does Windows alone).

  2. qwop says:

    I guess it is a mix of weird wndHandles and composition: Sometimes in my home computer, a contextual menu redraw gest stuck in my screen. Then killing the owner process doesn’t clear it. However, killing dwm.exe (the windows 7 composite manager) do clear it. This probably deserves one of those interesting Raymond Chen articles.

  3. Tyler says:

    “I guess, but turning off a feature hardly counts as fixing it” — could say the same about not using sidebar.exe or ipoint.exe

    • brucedawson says:

      Agreed. All previous fixes/workarounds to this bug required turning off some feature. I was lucky in that I didn’t care about ipoint.exe and sidebar.exe, but some people do.

  4. Pingback: Alt+Tab Depth Inversion Bug | Random ASCII

  5. Pingback: Other Causes of Alt+Tab Problems | Random ASCII

  6. movntdqa says:

    “The programs that create zero-sized always-on-top windows should stop doing that. It’s just weird.”

    Unfortunately, those are work-arounds for Windows APIs. I’ve seen several issues that could only be fixed with that, and several for which it was the simplest fix.

    • brucedawson says:

      I believe that zero-by-zero windows need to be created, but I’m not convinced that they need to be visible and always-on-top. Do you know if they do? Also, out of curiosity, do you know what issues these windows are used to fix?

      And of course, the real bug continues to be in Windows Explorer for not handling these.

  7. Bill Barto says:

    Thank you for the dogged determination to dig into the *real* reasons behind this. I too was sure it was something to do with always-on-top windows, but I don’t have the tools or the inclination to dig into like you did! I’ve noticed similar weirdness happens when you use the full-screen viewing options for some past versions of IE – after I did that, even my normal windows/start/toolbar wouldn’t scroll up correctly from the bottom. In summary, all previous versions of (windows) explorer have some sort of display bug with the always-on-top windows and this is just another incarnation of that now that more programs use those types of windows.

  8. Pingback: Defective Heat Sinks Causing Garbage Gaming | Random ASCII

  9. Peter Vredenburgh says:

    Didn’t fix a thing for me…

  10. Robin says:

    Instantly fixed for me! Thank you, this was driving me crazy but like others, I didn’t have the time to dedicate to finding a fix, although I would have loved to! I had previously fixed this by getting rid of ipoint.exe, although I agree disabling features is not a ‘fix’, the bug had reared it’s ugly head again recently and is now gone.

    One thing though, the file AltTabFixOnce.exe was flagged as a virus by my companies antivirus (F-Secure). I have a lot of respect for Valve and extended that to yourself so I figured I’d trust that this was a false-positive. AltTabFixContinuous.exe was not flagged as a virus.

    Props for including the source code too!

    • brucedawson says:

      I don’t know why AltTabFixOnce.exe is flagged as a virus. That’s frustrating. If in doubt you can always rebuild it from source.

      Keep in mind that this blog and those tools aren’t associated with Valve — I just happen to work there.

      • Robin says:

        No, I didn’t think the blog/tools were associated with Valve, but since you were associated with them I decided to trust that the AV was giving false positives (plus, I didn’t actually run the files flagged as malicious!). Normally, I wouldn’t have taken the risk of running executables downloaded from a blog that AV thought were suspicious.

        In case you were wondering, F-Secure flags it as “DeepScan:Generic.Malware.P!Pk!.28956A22”. It doesn’t mean much to me, but it’s a generic heuristic scan so it could be something a simple as the code structure. It’s not being flagged as any known virus or malware.

  11. SWB says:

    Bruce, this is awesome. I was plagued by the same problem for years. In fact, I didn’t even realize it was a bug, since my Windows 7 installs (all on ThinkPads) have always behaved this way. I assumed that’s the way Microsoft (stupidly) designed it to work. I finally became so annoyed with the behavior, though, that I went looking for a way to turn it off and found your article. In my case, the offending process (which I identified by running your AltTabFixOnce.exe) was tpnumlkd.exe, an on-screen NumLock display utility installed on ThinkPads (note: NOT a child process of ipoint.exe, sidebar.exe, or iexplore.exe). Your program fixed it right up, and I now have AltTabFixContinuous.exe on autorun. This made my day. Thanks!!!

  12. NetMage says:

    Since I only have this happen with Intellipoint and I don’t need it to run continuously, but I don’t want to have to hit enter every time I start, I created another version, AltTabFixOnceNoPause that doesn’t have the getc() call.

  13. Michel says:

    Hi,
    Congratulation. It seems to be a good and usefull job.
    BUT it is not working for me:
    After running AltTabFixOnce, I get the list of two explorer.exe and the following message “2 visible always-on-top windows fund, 0 fixed.”
    I tried to run it as admin but same result.
    Any hint ?
    Rgds,
    Michel

    • brucedawson says:

      If there aren’t any visible always-on-top windows to fix then my program can’t help you. Running as administrator won’t help. Your problem must have another cause. Sorry. Try reporting the problem to Microsoft.

      • Sai says:

        Microsoft ain’t gonna help one bit. I have the same problem after I installed new pc parts and tried to play a game full screen without it alt tab continuously, tried the fixer it didn’t fix it.

  14. crgolden says:

    Great work! Thank you so much. This bug has plagued me for years.

  15. Pingback: Bugs I Got Other Companies to Fix in 2013 | Random ASCII

  16. A. Jung says:

    Based on your source code I created a modified version that also fixes this problem for avpui.exe (Kaspersky User Interface process).
    see: http://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/alt-tab-window-wont-stay-on-top-of-other-windows/9795ed00-3e9f-4751-8e6b-da9a25e820e0?page=16

    I hope they are useful to others and I hope it’s OK that I released these modified versions.

    • brucedawson says:

      That’s great! Thanks for doing that, and thanks for letting me know.

      Is the Kaspersky window off-screen, or is it invisible for some other reason?

      • A. Jung says:

        I investigated a bit more about this problem.
        The Kaspersky window that causes the problem has the following properties:
        ————————————————————————————————
        title: ”
        class: ‘AVP.SandboxWindow’
        base class: ‘AVP.SandboxWindow’
        style: 94000000
        WS_POPUP WS_VISIBLE WS_CLIPSIBLINGS
        exStyle: 000800a8
        WS_EX_TOOLWINDOW WS_EX_TOPMOST WS_EX_TRANSPARENT WS_EX_LAYERED
        window rect: 0, 0 to 1366, 768
        window region type: NULLREGION
        process: avpui.exe
        ————————————————————————————————
        The screen size is 1366×768, i.e. it covers the whole screen.
        I checked on Win 7 and Win 8.1 and interestingly it breaks Alt+Tab on both versions, but on Windows 8.1 it additionally also breaks the taskbar live previews (they also appear behind windows instead of in front). So something between these windows versions changed that made the problem even worse.

        I don’t know what Kaspersky tries to achieve with that window. I verified that removing the visible or topmost flag has afaict no negative consequences. Everything that I tested still works (Main window, Settings window, other UI windows, info and virus warning messages) when these flags are unset on the above window. Whatever they tried to do, if it breaks basic Windows functionality that’s pretty bad. (Of course Windows is at fault here, too. Topmost visible windows should be correctly handled.)
        I will collect all info I have about this problem and report it to Kaspersly and we’ll see what they have to say about this.
        ————————————————————————————————
        Broken Alt-Tab: https://drive.google.com/file/d/0B-TTujCqmfzCUG83VXlCUloxcDQ/edit?usp=sharing
        Broken taskbar live previews: https://drive.google.com/file/d/0B-TTujCqmfzCVmk5dlU4MVIzbU0/edit?usp=sharing
        ————————————————————————————————
        Tool used to print additional details about all visible topmost windows:
        file selection download: https://drive.google.com/file/d/0B-TTujCqmfzCX3RoaTB6dGdQZFU/edit?usp=sharing
        zip download: https://docs.google.com/uc?id=0B-TTujCqmfzCX3RoaTB6dGdQZFU&export=download

  17. Matt says:

    Fixing alt+tab depth problems by clearing the visible flag on all
    zero by zero always-on-top visible windows.

    Listing all visible always-on-top windows.
    Title: ‘Start’ style: 94000c00 exStyle: 00080088 2, 1040 to 54, 1078, explor
    er.exe
    Title: ” style: 96840000 exStyle: 00000188 -2, 1036 to 1922, 1082, explorer
    .exe
    2 visible always-on-top windows found, 0 fixed.

    Alt+tab should now work correctly. To have this fix run every time
    you type Tab just copy AltTabFixContinuous.exe to your startup folder.
    This program is provided free of charge to fix the problems discussed here:

    Alt+Tab Depth Inversion Bug


    Copyright 2013 Cygnus Software.
    Press enter to exit.

    seems to work at first then it stops???? but it also says here that 0 were fixed?

    • brucedawson says:

      In order to avoid causing problems my program only turns off the visible flag for 0x0 windows, so it leaves those two windows alone. It’s not a perfect heuristic, but I wanted to make sure I didn’t make things worse. In this case it decided there was nothing to do. Then it stopped, ’cause it was done. The source is available if you want to experiment with changing it.

  18. Shannon says:

    how does one un-install this? I cannot seem to stop it so that I can remove it from my startup folder…

  19. Carlos says:

    In case you are still following this, it is still happening. Got a new Win7 64 PC and it was working perfectly while I did all the initial configuration as Admin. As soon as I created other regular users accounts, it started happening to the regular user account only. Downloaded your tool, we’ll see what happens.

    • Carlos says:

      Forgot to mention that using F11 in IE seems to fix the problem but it will come back eventually, sometimes in a matter of minutes.

  20. bookraiders says:

    Hi! I found this same bug in my fresh install of Windows 7, which I started using yesterday. After updating my graphics drivers (to deal with a BSOD-during-hibernation issue), lo and behold, my alt-tab icon listing got lost during Aero Peeks (after resuming from hibernation). I found your blog post linked from the 9th page of a 17-page-long forum on the subject (>_<).

    Unfortunately, I do not have ipoint.exe, I had not run IE11 during this session, and sidebar.exe is disabled, so obviously none of those were my problem. HOWEVER, I read about how you solved the problem, and decided to do some investigating with NirSoft's WinLister. Once again, I rolled snake-eyes: I do not have any 0x0 always-on-top windows while the problem persists, and while there *was* a process from an AMD driver utility which is off-screen *and* always-on-top, toggling its always-on-top flag had no effect.

    However, I did notice that the Windows Start button shows up in the list (Title:Start; Class: Button), and after toggling its always-on-top flag (by pressing F9), the problem was fixed!

    Just thought I'd leave this here, as another piece in the puzzle for people who do not have ipoint.exe, iexplore.exe or sidebar.exe running, and for whom your application does not work. I'm assuming the problem lies with DWM (the compositing window manager) and its z-index registration, as I never had this problem when I was running without Aero.

  21. Uwe Sieber says:

    Just got a report that my USB Drive Letter Manager (USBDLM) is causing this Alt-Tab problem too. Indeed it uses a visible topmost, zero size window at -1, -1 for receiving drive letter notifications.
    I never came across this problem because I work with the classic stlye without the DWM most of the time. I will try to make the window invisible.

    • brucedawson says:

      Thank you for addressing this. It is unfortunate that Windows explorer can’t handle this properly but until then we will have to depend on developers avoiding these problematic windows.

  22. Uwe Sieber says:

    I’ve changed USBDLM, it now uses an invisible, non-topmost window which seems to work too so far. A beta release is available:
    http://www.uwe-sieber.de/usbdlm_e.html#beta
    I think I had made the windows visible and topmost to be the first one who receives broadcast notifications. Irrelevant since many years…

  23. Eddy says:

    In W10 Microsoft must have not read this post because instead of fixing it they eliminated it. A real bummer for me. Bruce, if you can figure out how to get the old W7/W8 alt/tab style back we would really appreciate it.

    • brucedawson says:

      I assume by the W7/W8 behavior you mean the aero-peek that would hide all windows except the active one? Sorry, no ideas on how to get back. I suspect Microsoft decided it was too confusing.

      They do seem to have removed (or hidden) a bunch of useful features. Such a shame. It makes it hard to believe in continuous improvement – it’s more like change for the sake of change.

  24. Eddy says:

    I think MS gets new managers and the new manager always thinks “I have a better idea”. This has been the history of everything MS does. I just wish they concentrate on fixing their bugs rather than just making you learn everything over again.

  25. Yaniv says:

    hi there.
    Don’t know if it’s related, but switching too quickly between Office Word documents on my brand new Lenovo (office 365, windows 10) crashes the program – but only when using alt+tab, never if I just point and click.
    It doesn’t always happen, but does so enough that it’s quite a nuisance.
    Any idea on a possible cause?
    Turning off hardware acceleration did nothing for me, and I couldn’t find any mention of the problem anywhere else.
    tia!
    Yaniv.

    • Edward Quicksall says:

      The feature was to allow you to view the full page of an app as you move each app through using alt/tab. For Windows 7 that bug is fixed by AltTabFixOnce (search for it). Microsoft “fixed” the bug in Windows 10 by removing the feature. So in W10 as you use alt/tab you only see small windows instead of large ones.

      • Yaniv says:

        Not quite sure how your comment relates to mine… I’ve a completely different problem with the alt+tab combination.

        • Edward Quicksall says:

          Above it says this “Windows 7 has an annoying bug that causes alt+tab to malfunction for many people. This bug, previously discussed on this blog in Alt+Tab Depth Inversion Bug, causes the grid of programs to be partially or completely hidden, making it much harder to switch between programs” which is exactly what I gave a solution for.

    • brucedawson says:

      It’s hard to tell. I’m tempted to say that it’s definitely Microsoft’s fault because they wrote both Alt+Tab and Office, but in fact it could also be a bug in your graphics driver, anti-virus, or ???
      Make sure all updates are applied, and maybe get an expert to look at the crashes to see if there is a clue – often the crashing module is the culprit. Good luck.

      • Yaniv says:

        cheers.
        I’m also tempted to say it’s Microsoft’s fault because… well, most things are.
        The machine is always updated, and has just had it’s disk replaced, so I know the problem existed with two separate Windows installs (both of them 10).
        But I’ll go take a closer look at the graphics driver.

  26. Edward Quicksall says:

    Hmm, my notes give this URL. My suggestion is actually this thread which has become too long to read.

  27. Son of a gun! I will be subscribing to your feed. Babies and small animals probably love you. There are certainly a lot of details to take into consideration.

  28. Jesse Grillo says:

    Your page really maked me think. magnificent little bit of written content.

  29. mlewski says:

    Thank you for you work on this! Such an annoying usability bug. So glad to have found a fix, however hackish it may be.

  30. Jim Burd says:

    Just thought I would drop a note to say “Thanks for this!” and let you know that it still brings joy to people out there.

  31. Just a note, AltTabFixContinuous.exe also seems to fix a bug I never bothered to trace down where switching between Windows occasionally has the wrong z-order while using the AltTabSettings=1 setting to get the old alt+tab dialog that does respect z-order completely instead of inconsistently. I assume some but not all windows with the properties you outlined above can cause the z-order to sneakily change? Not sure.

  32. Eddy Quicksall says:

    English please

  33. Eddy Quicksall says:

    Windows 10 doesn’t have the bug. MS simply removed the feature.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.