How to disable/enable keyboard input and mouse input 
Author Message
 How to disable/enable keyboard input and mouse input

hi
could anyone help me,
I'm writing a program which at one point in time I do not want the user
to interrupt the processing
thus I need to know how to prevent both inputs from keyboard and mouse
while allow the Sendkeys function to work .
(code s{*filter*}t or API functions will do)


Thu, 13 Feb 2003 12:32:23 GMT  
 How to disable/enable keyboard input and mouse input
This will disable the keyboard inculding CTRL-ALT-DEL and ALT-TAB by making
the comp belive the screen saver is on by seting spi_screensaverrunning,
Warnning will NOT work with NT

The mouse pointer is then confined to the form, you could then check all
mouse clicks, or possiblbly have this all on a form with the message please
wait etc.

just copy onto a form, and call locksys to disable keyboard and mouse and
unlocksys to unlock.

Be sure to call unlocksys in the form_unload or your stuck like that until
you reboot or run it again.

wonko
"the answer is 42, who cares what the question was"

Private Const SPI_SCREENSAVERRUNNING = 97&
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
lpvParam As Any, ByVal fuWinIni As Long) As Long

    Private Type RECT
        left As Integer
        top As Integer
        right As Integer
        bottom As Integer
    End Type

    Private Type POINT
        X As Long
        Y As Long
    End Type

    Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
    Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long,
lpRect As RECT)
    Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long,
lpPoint As POINT)
    Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal X As
Long, ByVal Y As Long)

Private Sub LockSys()
    Dim lngRet As Long
    Dim blnOld As Boolean
    Dim client As RECT
    Dim upperleft As POINT
    ' keyboard
    lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, blnOld, 0&)
    ' mouse
    GetClientRect Me.hWnd, client
    upperleft.X = client.left
    upperleft.Y = client.top
    ClientToScreen Me.hWnd, upperleft
    OffsetRect client, upperleft.X, upperleft.Y
    ClipCursor client
End Sub

Private Sub UnlockSys()
Dim lngRet As Long
Dim blnOld As Boolean
    'keyboard
    lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, blnOld, 0&)
    'mouse
    ClipCursor ByVal 0&
End Sub


Quote:
> hi
> could anyone help me,
> I'm writing a program which at one point in time I do not want the user
> to interrupt the processing
> thus I need to know how to prevent both inputs from keyboard and mouse
> while allow the Sendkeys function to work .
> (code s{*filter*}t or API functions will do)



Fri, 14 Feb 2003 09:49:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to disabled/enabled keyboard input ?

2. Disable Keyboard and Mouse Input

3. How to disable keyboard and mouse input?

4. How to disable the keyboard and mouse input??

5. Can you disable keyboard and mouse input??

6. disable all keyboard and mouse input

7. Anybody know how to disable mouse/keyboard input to whole system

8. HOWTO: Disable user mouse input but still allow software to play mouse events

9. Disable/Enable mouse and keyboard

10. Disable/Enable mouse and keyboard

11. Enable/Disable mouse clicks and keyboard key clicks

12. Enable/Disable mouse clicks and keyboard

 

 
Powered by phpBB® Forum Software