I am working on a UWP screen recorder, I need a global shortcut (keyboard hotkey) that just launches the app, so I need a background process that runs from start-up, allowing me to launch the app at any time. I don't need to perform any in-app action. I could find some tutorials about global shortcuts in uwp apps, but they refer only to in-app actions and the Win32 process doesn't run with the app closed, so I couldn't figure out how to do with my app.
Asked
Active
Viewed 354 times
2
-
Do you mean you want to create a background Win32 process to launch a uwp app? When the system startup, running the Win32 process? Can you provide more details about your expected behavior? – Faywang - MSFT Aug 31 '20 at 05:14
-
Yes, and when I press the shortcut the process opens the app. For the future, I was thinking about making that optional, but currently I just would like to figure out how to do that and if it is possible – MarcAnt01 Aug 31 '20 at 12:56
-
You could follow the tutorial @Bogdan Mitrache shared and then when click the hotkey you registered, the hotkeys_HotkeyPressed event will be triggered from the sample, you could try to launch the uwp app in it. – Faywang - MSFT Sep 01 '20 at 06:36
-
Yeah, that's my plan, but I don't really understand how to launch the app from there – MarcAnt01 Sep 01 '20 at 07:13
-
1You could try to set [Protocol](https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/automate-launching-uwp-apps) in uwp app and then use `Process.Start()` method to launch it. – Faywang - MSFT Sep 01 '20 at 08:45
-
Thanks, that's the answer I was looking for – MarcAnt01 Sep 01 '20 at 14:26
1 Answers
0
Stefan Wick (form MSFT) had a detailed blog post about how you can do this.
As he mentions at the end of the blog post, another SO thread was the inspiration:

Bogdan Mitrache
- 10,536
- 19
- 34
-
Thanks, but what I mean is a global (keyboard) shortcut (like Win + O), not a shortcut to launch it from cmd – MarcAnt01 Aug 31 '20 at 13:08
-
Thank you, but I am already following the tutorial and it uses global shortcuts to perform an in-app action, while I'd like to use them to open the uwp app – MarcAnt01 Aug 31 '20 at 19:04