public class Class1
{
[DllImport("user32.dll", EntryPoint="SystemParametersInfo", SetLastError = true)]
public static extern bool SystemParametersInfo(uint action, uint param, ref int vparam, uint init);
const int SPI_GETSCREENSAVERRUNNING = 0x0072;
public static bool IsSaverRunning()
{
int IsRunning = 0;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING,0,ref IsRunning,0);
if (IsRunning==0)
return false;
else
return true;
}
}
}
this can be called from a standard windows timer or similar like
if (Class1.IsSaverRunning())
{
//Handle saver running here
}
Should work on all versions of windows from 98 / win2K - will not work on 95 or NT4