Sending Windows key using SendKeys

后端 未结 4 1565
滥情空心
滥情空心 2020-11-29 05:44

I am working on shortcuts in C#. I succeed implementing Ctrl, Alt and Shift with SendKeys.

Like this;

Ctrl + C:

System.         


        
4条回答
  •  情深已故
    2020-11-29 06:18

    download InputSimulator from nuget package.

    then write this:

            var simu = new InputSimulator();
            simu.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_E);
    

    in my case to create new vertial desktop, 3 keys needed and code like this(windows key + ctrl + D):

            simu.Keyboard.ModifiedKeyStroke(new[] { VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL }, VirtualKeyCode.VK_D);
    

提交回复
热议问题