Click here to Skip to main content
15,039,149 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to write a code which will disable Mouse and Keyboard for a particular period of time. It should disable use of mouse or keyboard through hardware. We should be able to use mouse and keyboard in programmatic way. This is because we want to do automation but make sure tat user do not disturb automation.

What I have tried:

I have searched a lot to disable programetically disable hardware in C# but it is not helping me out.
Posted
Updated 8-Jul-16 5:23am

1 solution

You can install global hooks for keyboard and mouse events. In the event handlers you can "eat" messages or let them pass on specific circumstances.

Some useful links:
Processing Global Mouse and Keyboard Hooks in C#[^]
Application and Global Mouse and Keyboard Hooks .Net Libary in C# - Home[^] (from the same author as the above CP article)
Low-Level Keyboard Hook in C# | Stephen Toub[^]
Low-Level Mouse Hook in C# | Stephen Toub[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900