Utilisation de SystemParametersInfo à partir de C # (SPI_GETSCREENREDER SPI_SETScreenReader)

StackOverflow https://stackoverflow.com/questions/5434709

  •  12-11-2019
  •  | 
  •  

Question

Est-ce que je fais cela correctement?

[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);
}

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top