Service cannot wake up system in Modern standby

minjiew 1 Reputation point
2021-08-23T06:40:33.223+00:00

Hi,

I programmed a windows background service, it needs to wake up system from modern standby.
I have tried PowerSetRequest and SetThreadExecutionState, but neither of them is not working.
Test step

  1. Service running background, every 2 minutes print a log to a file.
  2. User clicks the Sleep button.
  3. No log printed in file during Sleep.

Please advise how can service wake up the whole system during Modern standby.

Thanks

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,715 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,676 Reputation points
    2021-08-23T20:06:07.007+00:00

    Hello @minjiew ,

    After doing some research I had some conclusions.

    How do <rescap: Capability Name = "extendedExecutionUnconstrained" /> and <rescap: Capability Name = "extendedBackgroundTaskTime" /> cooperate with modern standby?

    note: If you add the above features, the background task will run uninterrupted.

    When the extended run session is active and I press the power button on a device that supports modern standby, what happens?

    note: The background task will continue to run as modern standby would only affect foreground tasks and the timer will continue uninterrupted as it is a process that can run while a machine is in standby mode.

    When a TimeTrigger triggers my task in the background and my app uses the extendedBackgroundTaskTime restricted feature, will the task run indefinitely?

    note: Yes, the task can run indefinitely. Note that when TimeTrigger is triggered a second or third time, a new task will be created and the currently existing task will still be running. If you don't need multiple tasks running at the same time, remember to close old tasks.

    Are TimeTriggers really active in modern standby?

    note: Yes, exactly as mentioned above

    Both answers assume that the machine is not running on battery. If the machine enters battery saving mode, the situation may change and these processes may be suspended.

    If the answer was helpful, please don't forget to vote up or accept as an answer, thanks.

    Yours sincerely,
    Samuel


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.