Is there a way to invoke default Windows shortcuts like Win + V programmatically in WinUI UWP?
Some shortcuts, like Win + V, don't have any API calls as far as I know. Hence, I want to invoke them by triggering them programmatically. Is there a solution?
As suggested by @Zer0, I used keyboard input injection. It is working. But, after injection, the physical keyboard starts to malfunction. The keys which I press on the keyboard map to different keys and Windows starts opening random applications. This issue persists for 10 seconds even after closing my application. After 10 seconds, this issue disappears. Why is it behaving so?
By the way, this is my code:
var V = new InjectedInputKeyboardInfo();
V.KeyOptions = InjectedInputKeyOptions.None;
V.VirtualKey = (ushort)VirtualKey.V;
var Win = new InjectedInputKeyboardInfo();
Win.KeyOptions = InjectedInputKeyOptions.None;
Win.VirtualKey = (ushort)VirtualKey.LeftWindows;
injector.InjectKeyboardInput(new[] { Win,V });