How do I turn off the windows screen saver if it is running using C#?

前端 未结 4 717
无人共我
无人共我 2021-01-19 20:21

Ok, so I found some code to check if a screensaver is running and kill it if I want to. This doesn\'t seem to work on Windows 7 PCs. Does anyone know how this code can be mo

4条回答
  •  借酒劲吻你
    2021-01-19 20:49

    Assuming you don't have a password-protected screensaver: (from http://support.microsoft.com/kb/140723)

    PostMessage (GetActiveWindow(), WM_CLOSE, 0, 0L);
    

提交回复
热议问题