0

Hi,
I am using vb.net framework 3.5. I want to lock input devices like keyboard and mouse from my application. Is their is anyway using sendkeys or any method to lock


Thanks in advance.............

3
Contributors
5
Replies
10
Views
6 Years
Discussion Span
Last Post by Unhnd_Exception
0

Thanks for your reply.
But the link provided by you is not helpful for me.
On button click i am generating a word file at the same time i am editing the word file means add header ,footer, page size using the sendkeys at that time i want to stop user to enter any key from keyboard or mouse action. After process completed it will activate again.

Here is code that i am trying but its not working..

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long

Public Shared Sub DisableInput(ByVal makeDisabled As Boolean)
Dim n As Boolean = BlockInput(makeDisabled)
End Sub

Edited by bhagawatshinde: n/a

0

Try this. It works on my end.

<System.Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function BlockInput(ByVal block As Boolean) As Boolean
End Function


dim blocked as boolean = BlockInput(True)
0

Hi , thanks for reply
i am used this code but nothing work.
is it correct way to write code
in class i am writing

<System.Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function BlockInput(ByVal block As Boolean) As Boolean
End Function

and in button click the following code write

dim blocked as boolean = BlockInput(True)

but its not working still the keyboard and mouse are not blocked
please help me.....

0

I can't get it not to work.

Maybe show some of the code your using.

Maybe just disable the form while your doing your processing. It seems a little strange you need to disable keyboard and mouse clicks over the entire operating system to make a word file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.