How can I check if the user wants animation (through the system settings for it)?

I would like to have animation in my program, but before I impose them on everyone (especially people with poor equipment), I would also like to check if they are even needed.

Therefore, I would like to check the setting in the Performance Option window (screenshot below).

Animate controls and elements inside windows setting

I noticed that some programs use it (so I know that it exists), so I believe that for this I should use an accessible API.

So my question is how can I check if this option is enabled or not?
This ultimately happens in a C # WPF application.

+4
source share
1

,

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

private static uint SPI_GETCLIENTAREAANIMATION = 0x1042;

static void Main(string[] args)
{
    try
    {
        bool animationsEnabled;
        SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0x00, out animationsEnabled, 0x00);

        if (animationsEnabled)
        {
            //Animate controls and elements inside windows is checked
        }
        else
        {
            //Animate controls and elements inside windows is not checked
        }
    }
    catch (Win32Exception ex)
    {
        //error
    }
}
+4

All Articles