Answered by:
Mouse and keyboard shutdown

Question
-
I have a question about the keyboard and mouse,
is it able to block input from the keyboard and mouse with a visual basic code?
(no typing or clicking etc)if it works please post the code.
I'm looking forward to receiving your reply.
Monday, September 19, 2011 10:09 AM
Answers
-
If you want to 'lock' the computer, you'd probably activate the screensaver or use any built-in operating system methods. While it may be possible to do what you want, it cannot be done natively through .NET. In addition, you wouldn't want to.
Stephen J Whiteley- Marked as answer by Mike FengModerator Wednesday, September 21, 2011 11:50 AM
Tuesday, September 20, 2011 11:54 AMModerator
All replies
-
use this code when you want to lock them.
System.Threading.Thread.Sleep(10000)
Also you can make it better with using a timer to take a password to unlock them.
- Proposed as answer by Rahul_Kr Wednesday, September 21, 2011 7:05 AM
Monday, September 19, 2011 11:00 AM -
Thank you for youre reply,
But isn't the code used to let the computer sleep?
Monday, September 19, 2011 11:07 AM -
Hi GreatYami,
To understand the code proposed by Görsel, check the following link: http://msdn.microsoft.com/en-us/library/d00bd51t%28v=vs.80%29.aspx
You should be more specific, do you want to block mouse & keyboard inputs in your application ? in a control ? other ? what exactly is your goal, since blocking user action is not very recommended.
Have a nice day :)
N'hésitez pas à poser des questions si un problème subsiste ou quelque chose n'est pas clair. Dans l'autre cas, veuillez indiquer que le problème est résolu. Cordialement - Best Regards. ContactMonday, September 19, 2011 12:27 PM -
Hello Michel K,
thank you for the link,
I want a button when clicked it blocks the input from mouse as wel from the keyboard.
My general goal is understanding the code, and i am making an application for my friend so that he can lock the computer at night.but is it also possible to make it unlock when you press a shorcut (customized) such as ALT + 9
Have a nice day too :)
Tuesday, September 20, 2011 9:30 AM -
If you want to 'lock' the computer, you'd probably activate the screensaver or use any built-in operating system methods. While it may be possible to do what you want, it cannot be done natively through .NET. In addition, you wouldn't want to.
Stephen J Whiteley- Marked as answer by Mike FengModerator Wednesday, September 21, 2011 11:50 AM
Tuesday, September 20, 2011 11:54 AMModerator -
okay,
thank you SJWhiteley for your reply.
I have enough info now to go on with the project :)
Have a nice day ^.^Tuesday, September 20, 2011 12:33 PM