Things I Learned Today - our daily eureka-moments

Programming .NET VS2010 Web Windows VS2012 S3 Search SQL SqlMetal Accessibility Amazon Android App BBQ EBS EC2 Exchange Food Garmin Geocaching GPS Grill Java Linq Lucene MVC PowerShell

Visual Studio IDE navigator stuck? - Carr, 29.11.2012

When working in Visual Studio, hitting Ctrl+Tab opens the "IDE Navigator".
This allows you to browse open files quickly, and releasing Ctrl should focus on the selected file.


Under certain conditions, the navigator window gets "stuck" and doesn't close when you release Ctrl - you'll need to manually close it by making a selection or closing the navigator.
This behavior occurs under the following conditions:

1) The registry value HKCU\Software\Microsoft\VisualStudio\[version]\General\NavigatorIsSticky is set to 1
2) Sticky keys are enabled in Windows
3) The SPI_GETSCREENREADER flag is set in Windows, which can be caused either by an actual screen reader, or by certain tools like Inspect.exe or AccEvent.exe from the Windows SDK

For condition 1 or 2, simply deleting the registry key or disabling sticky keys should solve the problem.
I experienced condition 3, most likely from one of the mentioned tools failing to unset the flag properly.

The simplest way to fix this is to run Inspect.exe and then close it, which should clear the flag.
Another way is to clear it yourself. Here's a C# console app example that will check the flag, clear it by passing SPI_SETSCREENREADER to SystemParametersInfo, then recheck:

using System;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            bool flagIsSet = false;
            bool tmp = false;

            // Check flag
            SystemParametersInfo(SPI_GETSCREENREADER, 0, ref flagIsSet, 0);
            Console.WriteLine("Flag set: {0}", flagIsSet.ToString());

            // Set flag
            SystemParametersInfo(SPI_SETSCREENREADER, 0, ref tmp, SPIF_SENDCHANGE);

            // Recheck flag
            SystemParametersInfo(SPI_GETSCREENREADER, 0, ref flagIsSet, 0);
            Console.WriteLine("Flag set: {0}", flagIsSet.ToString());

        [DllImport("user32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref bool pvParam, uint fWinIni);

        public const uint SPIF_SENDCHANGE = 0x0002;
        public const uint SPI_GETSCREENREADER = 0x0046;
        public const uint SPI_SETSCREENREADER = 0x0047;

Tags: VS2010 VS2012 Programming .NET Windows Accessibility
Nick @ 17.09.2015 16:22:
Thanks so much - I really was desperate about it!
ebo @ 31.10.2014 10:58:
OMG thank you so much! Couldn't work without setting this flag to false with the 3rd solution.
Gleb Sevruk @ 14.07.2014 18:26:
Thank you a lot! 3-rd fix worked!
Eventhorizon @ 29.05.2014 21:23:
You are a savior! Sollution 3 worked for me. I've had this issue with another computer for over a year caused by JAWS not uninstalling properly. Thank you!!!!!!!
Ivan @ 14.02.2014 02:28:
Solution 3 worked!! Thanks for saving my sanity.
Greg @ 28.05.2013 17:36:
FANTASTIC! I've been searching for solution #3 for nine months. I evaulated a screen reader for my blind father and after uninstalling it did not clear this flag.
Esle @ 18.04.2013 09:52:
Thank you, you're a live saver :-) This was really driing me nuts! Solution 3 worked!
Jase @ 12.04.2013 10:33:
Thanks! It works great. Even easier - I added this code as a macro straight in visual studio, so when it happens I simply click a button
Chris @ 05.02.2013 02:38:
Thank you thank you thank you!! This had been driving me crazy for weeks!