Just Code‎ > ‎

Notify when screensaver starts running

posted Aug 27, 2009, 6:47 AM by Peter Henell   [ updated Aug 27, 2009, 11:24 PM ]
More info here
http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx

[DllImport("user32", CharSet=CharSet.Auto)]
public static extern int SystemParametersInfo(int uiAction, int uiParam, ref bool pvParam, int fWinIni);
public static int screensaveractive =Win32Api.wins_Fields.SPI_GETSCREENSAVEACTIVE;
public const int screensaverrunning =0x72 ;
public static bool bScreenSaverrunning =false;

while(1)
{

    int i=SystemParametersInfo(screensaverrunning, 0, ref bScreenSaverrunning, 0);
     if (constants.bScreenSaverrunning)
     {
         MessageBox.Show("Screen Saver has Now started");
     }
}  
Comments