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.

Re: Locking the Keyboard & Mouse in VB.NET by hirf-spam-me-here

hirf-spam-me-here
Mon Nov 10 17:41:29 CST 2003

* "greg" <nonospam_gregory_may_nonospam@yahoo.com> scripsit:
> 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.

Have a look at the 'BlockInput' platform function:

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/BlockInput.asp>

You can unlock (for example) using a timer.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>

Re: Locking the Keyboard & Mouse in VB.NET by anonymous

anonymous
Mon Nov 10 18:18:54 CST 2003

Wow, Herfried:

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

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


THANKS!!!!
g.


>-----Original Message-----
>* "greg" <nonospam_gregory_may_nonospam@yahoo.com>=20
scripsit:
>> I am trying to Lock the Keyboard/Mouse under VB.Net. =20
I=20
>> am building an application where a workstation needs=20
to=20
>> be unusable at certain periods of time.
>
>Have a look at the 'BlockInput' platform function:
>
><http://msdn.microsoft.com/library/default.asp?
url=3D/library/en-
us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInpu
t/KeyboardInputReference/KeyboardInputFunctions/BlockInput
.asp>
>
>You can unlock (for example) using a timer.
>
>--=20
>Herfried K. Wagner
>MVP =B7 VB Classic, VB.NET
><http://www.mvps.org/dotnet>
>
><http://www.plig.net/nnq/nquote.html>
>.
>