Hello,
Welcome to Microsoft Q&A!
Can you help me how can i get the same functionallity as win10 operation system?
A workaround is that you could try to inject combined key inputs from code so you could directly start the snipping function like the old behavior in Windows 10.
Before we start to use the InputInjector Class, we will need to add inputInjectionBrokered restricted capability into the manifest file first.
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp rescap">
And in the Capabilities selection
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="inputInjectionBrokered" />
</Capabilities>
Then you could use the following code to inject keyboard input to directly start the snipping function.
private void Button_Click(object sender, RoutedEventArgs e)
{
//press key
InputInjector inputInjector = InputInjector.TryCreate();
var shift = new InjectedInputKeyboardInfo();
shift.VirtualKey = (ushort)(VirtualKey.Shift);
shift.KeyOptions = InjectedInputKeyOptions.ExtendedKey;
var win = new InjectedInputKeyboardInfo();
win.VirtualKey = (ushort)(VirtualKey.LeftWindows);
win.KeyOptions = InjectedInputKeyOptions.ExtendedKey;
var skey = new InjectedInputKeyboardInfo();
skey.VirtualKey = (ushort)(VirtualKey.S);
skey.KeyOptions = InjectedInputKeyOptions.None;
inputInjector.InjectKeyboardInput(new[] { shift, win,skey });
// release shift and win key
shift.KeyOptions = InjectedInputKeyOptions.KeyUp;
win.KeyOptions = InjectedInputKeyOptions.KeyUp;
inputInjector.InjectKeyboardInput(new[] { shift, win });
//bool result = await Launcher.LaunchUriAsync(new Uri("ms-screenclip: edit ? source = SOURCE"));
}
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.