Very simple project, Win7, VS2012, Winforms.
Popup a warning window 1 minute before a screensaver engages to inform the user they will be locked out soon.
However everytime I pop the window using the code below, the screensaver timeout is reset and my 1 minute turns into . I'm reading user32.dll "static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);" and the time there reflects the last time I moved the mouse, so at 0 minutes it equals .
I have a form with a notify icon that sits in the task bar. On load I call this.Hide() and notifyIcon1.Visible = true. When one minute hits I run either of the following that resets the timer.
void Maximize()
{
this.TopMost = false;
this.Show();
this.TopMost = true;
}
OR
void Maximize()
{
this.TopMost = false;
this.Show();
this.WindowState = FormWindowState.Normal;
this.TopMost = true;
this.Activate();
this.Focus();
}
What do you think, windows bug?