Looking for a way to lock keyboard

outlawspeeder

Board Regular
Joined
Jan 17, 2009
Messages
225
Office Version
  1. 2019
I have some display systems in my office. I cannot lock the computers in a room yet but untill then I need a way to lock the keyboard and mouse buttons. Not the pointer.


Below is the only thing i have found but only locks for this program. To add to this Debuging can lead to a lot of rebooting? I my be over my head with this.


I tried start:

Public Class Form1
Public Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlock As Integer) As Integer


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

apiBlockInput(1)
System.Threading.Thread.Sleep(100000)
apiBlockInput(0)
End
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
apiBlockInput(0)
End Sub
End
Class
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I have some display systems in my office. I cannot lock the computers in a room yet but untill then I need a way to lock the keyboard and mouse buttons. Not the pointer.


Below is the only thing i have found but only locks for this program. To add to this Debuging can lead to a lot of rebooting? I my be over my head with this.


I tried start:

PublicClass Form1
PublicDeclareFunction apiBlockInput Lib"user32"Alias"BlockInput" (ByVal fBlock AsInteger) AsInteger


PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

apiBlockInput(1)
System.Threading.Thread.Sleep(100000)
apiBlockInput(0)
End
EndSub

PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
apiBlockInput(0)
EndSub
End
Class

The BlockInput should normally block the keyboard and mouse input for all programs not just for the calling one.

I noticed that you are passing 0 to the blockinput function in the apiBlockInput routine which is wrong . You should pass to it the Form hwnd.
 
Upvote 0

Forum statistics

Threads
1,225,526
Messages
6,185,471
Members
453,296
Latest member
zashue22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top