How to detect if any of the process prevents Windows from sleep?

I want to check if any of the processes/applications use any approach to keep the windows system awake.

I find there is an API SetThreadExecutionState that can do this.

Even I find this kind of API, I still cannot find a way to get the state.

I think video players will use SetThreadExecutionState to keep the system awake temporarily. But the document also said

Applications such as word processors, spreadsheets, browsers, and games do not need to call SetThreadExecutionState.

As a windows service, I wanna determine if they set the state ON or not including the Applications that didn't need to call SetThreadExecutionState.