hi i want to fire an event if the screen saver starts up
i have done it using a timer tick event where i have used the api
function to detect if screensaver has started..but this means
continuous polling at each timer click..
private void tick(object sender, System.EventArg s e)
{
const int SPI_GETSCREENSA VERRUNNING = 114;
int screenSaverRunn ing = -1;
// is the screen saver running?
int ok = SystemParameter sInfo(SPI_GETSC REENSAVERRUNNIN G, 0, ref
screenSaverRunn ing, 0);
if (ok == 0)
{
Console.WriteLi ne("Call to SystemParameter sInfo failed.");
}
if (screenSaverRun ning != 0)
{
// screen saver is running
MessageBox.Show ("screensave r runs");
}
else
{
}
}
is there a better way of doing something like no use of timer..
i want someting like-- if screensaver starts then a event gets fired
and if screen saver stops another event gets fired..this wud avoid
getting in the loop of timer tick event..
So my question is "is it possible to just fire events if screen saver
starts or stops without using timer ??"
i have done it using a timer tick event where i have used the api
function to detect if screensaver has started..but this means
continuous polling at each timer click..
private void tick(object sender, System.EventArg s e)
{
const int SPI_GETSCREENSA VERRUNNING = 114;
int screenSaverRunn ing = -1;
// is the screen saver running?
int ok = SystemParameter sInfo(SPI_GETSC REENSAVERRUNNIN G, 0, ref
screenSaverRunn ing, 0);
if (ok == 0)
{
Console.WriteLi ne("Call to SystemParameter sInfo failed.");
}
if (screenSaverRun ning != 0)
{
// screen saver is running
MessageBox.Show ("screensave r runs");
}
else
{
}
}
is there a better way of doing something like no use of timer..
i want someting like-- if screensaver starts then a event gets fired
and if screen saver stops another event gets fired..this wud avoid
getting in the loop of timer tick event..
So my question is "is it possible to just fire events if screen saver
starts or stops without using timer ??"
Comment