Locking the Keyboard & Mouse in VB.NET

  • Thread starter Thread starter greg
  • Start date Start date
G

greg

I am trying to Lock the Keyboard/Mouse under VB.Net. I
am building an application where a workstation needs to
be unusable at certain periods of time.

There are two great articles on Locking/Unlocking the
keybaord/mouse in VB.NET:

http://www.codeguru.com/vb_system/PK041803.html

and

http://www.devcity.net/forums/topic.asp?
tid=25063&#RID75038

Both articles try to install a low level hook that
consumes keyboard/mouse events. Niether of these seem to
work when invoked as a background thread or as a console
application.

This approach used to work a few months ago (Unless my
memory is already going bad), but now, windows does
something wierd and kicks out the low level Hook. I am
wondering if one of thoes many security patches has made
hooks work differently?

If you try this code as a VB Windows application and tie
it to a button, it works. If you build this code under a
VB.Console application, it fails.

Does anyone have a suggestion/idea on how to lock the
Keyboard/Mouse as a VB.NET console application?

g.
 
Wow, Herfried:

This seems to take care of the bulk of my problem!!! It
appears Ctrl-Alt-Delete still gets through.

I am thinking of setting up a timer to Kill process
manager and reblock using your method. Do you know an
easier way?


THANKS!!!!
g.
 
Back
Top