This is from one of the forums, so you can test it yourself, but the idea is
to use interop to get the state from the SPI enum:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction,
int uParam, ref int lpvParam, int fuWinIni);
const int SPI_GETSCREENSAVERRUNNING = 114;
int screenSaverRunning = -1;
// is the screen saver running?
int ok = SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, ref
screenSaverRunning, 0);
if (ok == 0)
{
Console.WriteLine("Call to SystemParametersInfo failed.");
}
if (screenSaverRunning != 0)
{
// screen saver is running
}
ok,
aq
"Anthony" <An*****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
In C++ you can detect the screensaver state by using something like:
BOOL b=SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, NULL, &bOn, FALSE);
Is there an equivalent method that I can use in C#? If not, how can I
determine the state of the screen saver?
--
-Anthony