Share via

Global hotkey for UWP?

Hong 1,526 Reputation points
2021-02-28T13:07:17.53+00:00

Is it possible for a minimized (i.e. not focused) UWP app to listen to global hotkeys?
Is this SO answer still the best for this?

Developer technologies | Universal Windows Platform (UWP)

Answer accepted by question author

AryaDing-MSFT 2,916 Reputation points
2021-03-02T03:22:03.18+00:00

Hi,

Welcome to Microsoft Q&A!

Yes. Currently, there is no perfect solution to this issue.

As this link says, uwp app goes in suspended state when they are not focused. You can solve this by requesting "ExtendedExecutionSession" which will guarantee that your app never falls asleep when out of focus if "attached to wallpower".

Uwp can’t detect input without focus. CoreWindow.GetAsyncKeyState() works only when the Windows is focused. You can refer to the method mentioned in the answer to register F key as hotkey, but it is difficult to listen to lots of hot keys.


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Tom Lite 1 Reputation point
    2021-03-01T13:28:24.827+00:00

    Was this answer helpful?


Your answer

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