C #: How to determine if a screen reader is working?

How to determine if a screen reader (JAWS) is working?

As I understand it in .NET 4, we can use the namespace AutomationInteropProvider.ClientsAreListeningfrom System.Windows.Automation.Provider, but what if I have to do this for .NET 2.0?

I tried to check the source code ClientsAreListening, it calls an external method RawUiaClientsAreListeningfrom the UIAutomationCore.dll library.

Do you have any idea how to implement JAWS discovery in .NET 2.0?

+5
source share
1 answer

Use the SystemParametersInfofunction passing uiActionfrom SPI_GETSCREENREADER.

P/Invoke, :

internal class UnsafeNativeMethods
{
    public const uint SPI_GETSCREENREADER = 0x0046;

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

public static class ScreenReader
{
    public static bool IsRunning
    {
        get
        {
            bool returnValue = false;
            if (!UnsafeNativeMethods.SystemParametersInfo(UnsafeNativeMethods.SPI_GETSCREENREADER, 0, ref returnValue, 0))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "error calling SystemParametersInfo");
            }
            return returnValue;
        }
    }
}

, , ClientsAreListening, true , .

:

WM_SETTINGCHANGE, , / .


( BrendanMcK):

, , , :

, . , . , , .

, , , , , , ,

, , - , "" . , UI , , , , , .

+4

All Articles