-
Dec 9th, 2005, 02:31 PM
#1
Thread Starter
Junior Member
how can i disable keyboard?????? please help
wish that anyone can help me in this, im working on administration project, and i need to lock the client keyboard, specially viewing Task manager, can please anyone tell me how to disable it????? please i dont have enough time
-
Dec 9th, 2005, 02:46 PM
#2
Junior Member
Re: how can i disable keyboard?????? please help
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
--
The BlockInput function blocks keyboard and mouse input events from reaching applications.
---
ยท fBlock
[in] Specifies the function's purpose. If this parameter is TRUE, keyboard and mouse input events are blocked. If this parameter is FALSE, keyboard and mouse events are unblocked. Note that only the thread that blocked input can successfully unblock input.
U`ll Never Get To HEAVEN If U`re Scared Of Gettin` HIGH
-
Dec 10th, 2005, 02:10 AM
#3
Thread Starter
Junior Member
Re: how can i disable keyboard?????? please help
i didnt got it
can you please post a small example on it???? many thanks
-
Dec 10th, 2005, 04:03 PM
#4
Fanatic Member
Re: how can i disable keyboard?????? please help
VB Code:
Option Explicit
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Sub Command1_Click()
fBlock (True)
End Sub
-
Dec 10th, 2005, 04:50 PM
#5
Thread Starter
Junior Member
Re: how can i disable keyboard?????? please help
"Option" is not declared, how can i decleare it???
-
Dec 10th, 2005, 04:55 PM
#6
Re: how can i disable keyboard?????? please help
Just paste these two lines before any subs
VB Code:
Option Explicit
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Option Explicit tells the IDE that you will declare each variable before you use it. It prevents spelling errors in your code. You can check Require Variable Declaration in the Options page, to have the IDE automatically place it in each form, module, and class. It is highly recommended that you enable this options. It will save you a lot of grief, and get you into good coding habits.
-
Dec 12th, 2005, 08:44 AM
#7
Thread Starter
Junior Member
Re: how can i disable keyboard?????? please help
doesnt work yet, can you please send me small example??
-
Dec 13th, 2005, 02:30 AM
#8
New Member
Re: how can i disable keyboard?????? please help
this code blocks both keyboard and mouse....can you tell me how to modify it to only block the keyboard?
-
Dec 13th, 2005, 03:08 AM
#9
Re: how can i disable keyboard?????? please help
Nope. You'd have to use the KeyPress event, and set each keypress to 0, to eliminate it. Its not quite as easy.
-
Dec 13th, 2005, 07:17 AM
#10
Re: how can i disable keyboard?????? please help
 Originally Posted by Lightmoon1992
doesnt work yet, can you please send me small example??
Show us what you are doing and maybe we can figure out what you are doing incorrectly.
-
Dec 13th, 2005, 01:44 PM
#11
Thread Starter
Junior Member
Re: how can i disable keyboard?????? please help
many thanks everyone, i solve it by adjusting some values in registry
-
Dec 13th, 2005, 11:56 PM
#12
New Member
Re: how can i disable keyboard?????? please help
Ok well I didn't ask the question but maybe you guys can still help me instead.
I saw the code that dark_shadow and ghades posted.Well I can't seem to get their code to work. I keep getting a compile error it says sub or function not defined and highlights my command1_click. CommandButton.I know it is something easy and is right in front of me but I just can't see it. I am useing visual basic 6.0
Below is what I have enter in my frm
VB Code:
Option Explicit
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Sub Command1_Click() 'This is what is hightlighted in yellow
fBlock (True) 'It also hightlights the fblock in grey
End Sub
-
Dec 14th, 2005, 12:27 AM
#13
Re: how can i disable keyboard?????? please help
That wouldn't work. You would block the input, and wouldn't be able to unblock it. Try this sample to see that it works. It uses the sleep api to wait 10 seconds.
VB Code:
Option Explicit
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
DoEvents
'block the mouse and keyboard input
BlockInput True
'wait 10 seconds before unblocking it
Sleep 10000 ' for 10 seconds
'unblock the mouse and keyboard input
BlockInput False
Unload Me
End Sub
-
Dec 14th, 2005, 12:37 AM
#14
New Member
Re: how can i disable keyboard?????? please help
ok thxs for the help it works great. IF you really want to help you can take out you brain a give it to me lol jk.
-
Dec 14th, 2005, 01:07 AM
#15
Re: how can i disable keyboard?????? please help
Just hang around here. You'll pick up things, and will be able to help others. It keeps you sharp!
-
Dec 14th, 2005, 08:16 AM
#16
Re: how can i disable keyboard?????? please help
 Originally Posted by EckoDOG
ok thxs for the help it works great. IF you really want to help you can take out you brain a give it to me lol jk.
It is brains, yes, but it is also experience and you can't teach that!
-
Nov 20th, 2008, 01:00 PM
#17
New Member
Re: how can i disable keyboard?????? please help
Hello. Im trying to do the same as them. My skills are not as good as yours, but I have a problem. I have to make a program, which can block the keyboard?
Which codes would you use?
-
Dec 19th, 2008, 11:18 AM
#18
Lively Member
Re: how can i disable keyboard?????? please help
Cant simply do something like this?
Code:
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
Dim KeyResult As Integer
Dim i As Byte
For i = 1 To 254
KeyResult = GetAsyncKeyState(i)
If KeyResult = -32767 Then
If i < 255 Then
MsgBox "apple"
Else
End If
End If
Next
End Sub
http://www.vbforums.com/showthread.php?t=550216
Last edited by Pezster; Dec 19th, 2008 at 11:25 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|