Question Lock Mouse and Keyboard

tukmolins

Member
Joined
Oct 21, 2011
Messages
12
Programming Experience
1-3
Hello. I'm creating a form that will block the functionality of keyboard and mouse but apparently it is not working. Can someone help me if there is something i missed and need to be added?


Here is my code:
Public Class Form1
    Declare Function BlockInput Lib "User32" (ByVal fBlockIt As Boolean) As Boolean
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        BlockInput(True)
    End Sub
End Class
 
According to some comments on the web BlockInput requires UAC elevation on Vista/W7.

If intension is to block input to your form only it would be better to set Enabled property to False.
 
It depends on what you are wanting to accomplish / why you are wanting to block input (I'm guessing for some kind of remote administration purpose?). If it is for remote admin purposes can't you just send a form with no controls that is maximised with a message or whatever you want on it? You can always only act upon certain key presses then (like the demo software in PC World etc does then).

As JohnH suggested though, if there are form elements on there just don't enable them, or are you wanting to get input from a different device (other than keys/mouse)?
 
Yes it is for a remote administration system sir. Well if i use a form and maximized it, isn't ctrl+alt+delete or alt+tab will work?
 
Ctrl-alt-del will work regardless, in fact that is exactly the key combination that is documented to unblock input.
 
Oh ok. so maybe i will find another solution that my application will not be seen in task and list of process in task manager. Do you think it is possible JohnH?
 
Back
Top