I have a program that I would like to see if the mouse or keyboard has had inactivity for a certain amount of time then turn off the monitor. Unfortunately the way I set it up, when every i move the mouse through the screen it turns off the mouse with no delay.
my code looks like this, and i am aware that the implementation is all wrong.
|
|
Private Sub tmrScreen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrScreen.Tick |
SendMessage(frmMain.Handle.ToInt32, WM_SYSCOMMAND, SC_MONITORPOWER, MON_OFF) |
tmrScreen.Stop() |
End Sub |
Private Sub Mouse_Movement(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove |
If (SendMessage(frmMain.Handle.ToInt32, WM_SYSCOMMAND, SC_MONITORPOWER, MON_OFF)) = False Then |
tmrScreen.Stop() |
tmrScreen.Enabled = False |
tmrScreen.Enabled = True |
End If |
End Sub |
|
|