Programmatically prevent Windows screensaver from starting

后端 未结 13 2052
心在旅途
心在旅途 2020-12-03 00:58

Is there a recommended way to prevent the Windows screensaver from starting? The closest thing I\'ve found is this article, but what I would really like to do is just tell

13条回答
  •  长情又很酷
    2020-12-03 01:46

    Can't believe no one has pointed out the easy and obvious solution:

    #include 
    
    void main()
    {
       while(1){
          INPUT input;
          input.type = INPUT_MOUSE;
          input.mi.dx = 1;
          input.mi.dy = 1;
          input.mi.mouseData = 0;
          input.mi.dwFlags = MOUSEEVENTF_MOVE;
          input.mi.time = 0;
          input.mi.dwExtraInfo = 0;
          SendInput( 1, &input, sizeof(input) );
          sleep(60000);
       }
    }
    

提交回复
热议问题