SendMessage/SC_MONITORPOWER won't turn monitor ON when running Windows 8

前端 未结 4 1137
死守一世寂寞
死守一世寂寞 2020-12-03 14:22

I turn my monitors on and off by using the following code:

[DllImport(\"user32.dll\")]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam,          


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 14:40

    I had the same idea for this issue Just Changed the dear earlypearl's solution a wee bit and tested it on windows XP, 7, 8, Server 2008 and all worked perfectly.

    mouse_event(MOUSEEVENTF_MOVE, 0, 1, 0, UIntPtr.Zero);
    

    it does not need to be called twice.

提交回复
热议问题