How to programatically prevent Windows from hard disk drive spin down?

前端 未结 2 1106
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 15:16

My program performs a task on the hard disk free space. The task is quite long, it takes 1-2 hours.

The problem is that on laptop the hard disk may be t

2条回答
  •  猫巷女王i
    2021-02-04 15:35

    Windows does not allow applications to disable power control changes, because buggy applications were causing batteries to be drained. See http://blogs.msdn.com/b/oldnewthing/archive/2007/04/16/2148139.aspx

    You can get notified when the system power status is about to be changed. See WM_POWERBROADCAST Messages.

提交回复
热议问题