Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions PSReadLine/Accessibility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/

using System.Runtime.InteropServices;

namespace Microsoft.PowerShell.Internal
{
internal class Accessibility
{
internal static bool IsScreenReaderActive()
{
bool returnValue = false;

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
PlatformWindows.SystemParametersInfo(PlatformWindows.SPI_GETSCREENREADER, 0, ref returnValue, 0);
}

return returnValue;
}
}
}
6 changes: 6 additions & 0 deletions PSReadLine/PlatformWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,4 +604,10 @@ public override void BlankRestOfLine()
SetCursorPosition(x, y);
}
}

internal const uint SPI_GETSCREENREADER = 0x0046;

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