How can I detect if a hard drive is spinning (under Windows)? How can I detect if a hard drive is spinning (under Windows)? windows windows

How can I detect if a hard drive is spinning (under Windows)?


As I like to say, don't tell me about the bug - tell me about what you're trying to accomplish.

My code needs to check if a directory on a drive exists

OK, if that's the end goal, Windows provides an API for that called FindFirstChangeNotification. You can use the Change Notification APIs to spin up a thread and monitor when files or directories change.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365261(v=vs.85).aspx