Just how to lock the keyboard and mouse? Already viewed this page http://www.cyberforum.ru/csharp-beginners/thread595784.html
but this code does not work when starting the application.
Just how to lock the keyboard and mouse? Already viewed this page http://www.cyberforum.ru/csharp-beginners/thread595784.html
but this code does not work when starting the application.
Solution 1:
You can turn off the power to the device. I gave the answer how to do it here:
Enable / Disable USB Ports or Devices
Solution 2:
You can intercept through the WIN API to cancel any signal from the desired device.
Solution 3:
It is possible through the WIN API to block the input itself:
public partial class NativeMethods { /// Return Type: BOOL->int ///fBlockIt: BOOL->int [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint="BlockInput")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool BlockInput([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool fBlockIt) ; } public static void BlockInput(TimeSpan span) { try { NativeMethods.BlockInput(true); Thread.Sleep(span); } finally { NativeMethods.BlockInput(false); } } As can be seen from the method, it simply blocks the input from the mouse and keyboard for some time set via TimeSpan. I think it will not be difficult to figure it out.
The answer is found here: https://stackoverflow.com/questions/586547/how-can-i-block-keyboard-and-mouse-input-in-c
last found for "api block mouse input c #"
Source: https://ru.stackoverflow.com/questions/908234/
All Articles