I would like to know if Windows Transparency Effects are enabled or not in my C# program but couldn't find any API to retrieve that information. Does anyone know how to do it?
I guess there's a simple API doing that.
Thanks!
Stefan
I would like to know if Windows Transparency Effects are enabled or not in my C# program but couldn't find any API to retrieve that information. Does anyone know how to do it?
I guess there's a simple API doing that.
Thanks!
Stefan
I don't know weather there is a API provided by Microsoft in the Windows API to directly check whether transparency effects are enabled or disabled. You could try the below approach to get the result:
class Program
{
const int SPI_GETTRANSPARENCY = 0x104D;
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(int uiAction, int uiParam, out bool pvParam, int fWinIni);
static void Main()
{
bool transparencyEnabled;
bool success = SystemParametersInfo(SPI_GETTRANSPARENCY, 0, out transparencyEnabled, 0);
if (success)
{
if (transparencyEnabled)
Console.WriteLine("Transparency effects are enabled.");
else
Console.WriteLine("Transparency effects are disabled.");
}
else
{
Console.WriteLine("Failed to retrieve transparency effects information.");
}
}
}