Detecting If a Keyboard or Mouse is Connected with VB? RRS feed

  • Question

  • I am working on a project that is destined to be a small, freeware vote tallying program for my group. The program is designed not to be used with a keyboard so I am wondering if it would be possible to somehow set up a program so that it will refuse to operate unless it does not detect a keyboard? I am intending for the few systems used for vote tallying to be used for that purpose only but in the event they need to be "tweaked" ]:-> I would like the "trigger" to tell the program to prompt for an administrator password to be having a keyboard plugged in.
    I know that it is not that secure but if all you've got is a mouse, it's pretty darn hard to hack the program. In the event that someone does plug in a keyboard and exit the program without a password, I will just run a little "monitor" program in the background that will make the computer start beeping and flag down a supervisor.
    Thanks for any help!
    Thursday, December 29, 2005 10:22 PM

All replies


    Public Shared ReadOnly Property MouseButtons() As Integer

    Member of: System.Windows.Forms.SystemInformation


    Gets the number of buttons on the mouse.

    Return Values:

    The number of buttons on the mouse, or zero if no mouse is installed.

    I looked at all the classes involved with the keybord and saw no exact equivalent. Those classes didn't look encouraging although you may be trying to find something by trial and error.

    The other thing I'd recommend is WMI. I' sure it will have what you are lookig for.




    Thursday, December 29, 2005 11:27 PM