0

I have stuck at one place where I have to turn off the monitor and at background all my processes should work something like turn off the monitor only but cpu etc should work normally. Actually, my backend sends screenoFF command and accordingly I send a "SendMessage" command to off the monitor it is working fine on my laptop, but in production side system is going into sleep mode. I would appreciate If anyone could help here thanks.

Private Const WM_SYSCOMMAND As Integer = &H112
Private Const SC_MONITORPOWER As Integer = &HF170

<DllImport("user32.dll")>
Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal hMsg As Integer,
                      ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function

SendMessage(Me.Handle, WM_SYSCOMMAND, CType(SC_MONITORPOWER, IntPtr), CType(2, IntPtr))
user3546665
  • 41
  • 1
  • 6
  • Try the variations posted [here](https://stackoverflow.com/q/713498/14171304) and [here](https://stackoverflow.com/q/12572441/14171304). – dr.null Oct 16 '20 at 13:29
  • basically my code turn off the monitor and same I am running a timer that should update the database in 1 min of interval. this timer works when my monitor on but when it Off then database is also not updating. – user3546665 Oct 19 '20 at 12:27

0 Answers0