Results 1 to 3 of 3

Thread: For mikef or anyone else who wanted to know...

  1. #1
    Matthew Gates
    Guest

    Lightbulb

    Hopefully, you along with a few others that want to know how to do this, will read this. Especially if the thread has your name on it. I know I read threads with my name on them .

    Anyways...


    As you know, this code disables the keyboard:

    Code:
    Shell "rundll32 keyboard,disable"
    But this code does not re-enable it:

    Code:
    Shell "rundll32 keyboard,enable"
    Instead, it gives an error. Probably because the code was ment to disable the keyboard forever until the computer is restarted.

    Here is an API function that will be able to block out the mouse and keyboard and still be able to re-enable them.

    Of course, you will have to set a timer or something since you can't exactly click or press the keyboard to re-enable it.

    But you can use the BlockInput API function to do it.


    Code:
    Private Declare Function BlockInput Lib "user32" _
    (ByVal fBlock As Long) As Long
    
    Private Declare Sub Sleep Lib "kernel32" (ByVal _
    dwMilliseconds As Long)
    
    
    Private Sub Command1_Click() 
    
        DoEvents
        'block the mouse and keyboard input
        BlockInput True
        'wait 10 seconds before unblocking it
        Sleep 10000
        'unblock the mouse and keyboard input
        BlockInput False
    
    End Sub


    Hope this may be of use to you and anyone else that needs it, since I doubt you will get anywhere with the other code.

  2. #2
    Guest
    Thanks, I needed that a bit ago. I will file it away for next time.

  3. #3
    flintlock
    Guest
    This works great for WIn98 and WIn2000. How do you do this (disable and then enable) in WIn95? Some of my users still use win95.

    - John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width