简体   繁体   中英

Analog of SetThreadExecutionState in kernel32.dll for UWP

Many if not all "classic" WinAPI functions (including SetThreadExecutionState in kernel32.dll ) are not officially supported in UWP. Despite the fact that they can actually work in these applications.

The question is whether there are equivalent? Of course interested in primarily SetThreadExecutionState .

I assume you want a device to stay active while your UWP app is running.

A simple way to achieve that is using

displayRequest = new Windows.System.Display.DisplayRequest();
displayRequest.RequestActive();

// Do not forget to release afterwards
displayRequest.RequestRelease();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM