I need to check the accessibility tool (Narrator) is running in the windows platform .I have already tried with the following
1 one is not working and 2 one is also i have tried and it always showing the false while getting system parameters . 1.
AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged);
2.
[DllImport("user32", CharSet = CharSet.Auto)]
internal static extern long SystemParametersInfo(long uAction, int lpvParam, ref bool uParam, int fuWinIni);
public static bool IsScreenReaderRunning()
{
long SPI_GETSCREENREADER = 70L;
bool bScreenReader = false;
long retVal;
retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);
//uint iParam = 0;
//uint iUpdate = 0;
//bool result = false;
//bool bReturn = SystemParametersInfo(SPI_GETSCREENREADER, iParam, &bScreenReader, iUpdate);
return bScreenReader;
}
public static void ScreenReaderOn()
{
long SPI_GETSCREENREADER = 71L;
bool bScreenReader = true;
long retVal;
retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);
}
public static void ScreenReaderOff()
{
long SPI_GETSCREENREADER = 71L;
bool bScreenReader = false;
long retVal;
retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);
}