0

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?

ScottM
  • 15
  • 5
  • I removed everything except this.windowstate = Formwindowstate.Normal and still I get a screensaver timeout reset. Quite frustrating. I can't imagine every time I get an chat message on google talk that the screen saver resets. – ScottM Oct 23 '13 at 20:33
  • Had to manually code the locking of the system using this article, what a bust. http://stackoverflow.com/questions/1430108/how-to-turn-screensaver-on-windows-7-by-a-code-in-cmd – ScottM Oct 23 '13 at 20:50

0 Answers0