Sending WIN + CTRL + SHIFT + B using c #

I am trying to simulate the Win+ Ctrl+ Shift+ key combination Bbefore Windows 10 using Visual C # 2017.

This keyboard shortcut restarts the video driver and I can confirm that it works when I do it manually, but I cannot get a way to do it with C #.

I even tried http://inputsimulator.codeplex.com/ like this:

InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL);
InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT);
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_B);
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_B);
InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT);
InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL);
InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);

      

and like this:

InputSimulator.SimulateModifiedKeyStroke(
            new[] { VirtualKeyCode.LCONTROL, VirtualKeyCode.LWIN, VirtualKeyCode.LSHIFT },
            new[] { VirtualKeyCode.VK_B }
        );

      

Any help with a working solution is greatly appreciated!

+3


source to share


1 answer


I've tried this with several combinations and I'm wondering if some commands are not allowed.

For example, LWIN

+ VK_E

works fine for opening file explorer, but LWIN

+ VK_L

does not for locking the machine. LCONTROL

+ ESCAPE

works when trying to open the start menu as it does on LWIN

its own. It may be that what you are trying to do is seen as potentially "too risky" to handle in this way.



As an aside, I also ran Visual Studio as Administrator to make sure it wasn't user rights, but it didn't matter to me.

You might be able to extract something from this answer looking for a way to reboot the video driver using a different method.

0


source







All Articles