Solved

Lock/Disable Keyboard VS2008 VB.NET

Posted on 2011-09-30
5
803 Views
Last Modified: 2012-05-12
I am working on an application that I am in need of locking out the keyboard only.  How can this be done.

I am only interested in locking out the keyboard on a system level not the mouse.

Thanks in advance!
0
Comment
Question by:H-SC
  • 2
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 36891833
0
 
LVL 7

Expert Comment

by:vbigham
ID: 36894835
In addition to those articles, if you want to always handle the event you can just check if the ncode is greater than zero, if so return CallNextHookEx() otherwise just return 1 in your KeyboardHookCallback.

In case you need to do anything based on the which key was pressed (exit the application for example especially while debugging)
If you are using framework 3.0 or greater check out the KeyInterop Class methods in WindowsBase.dll
http://msdn.microsoft.com/en-us/library/system.windows.input.keyinterop(v=VS.100).aspx 

Otherwise, I have observed that many of the keycodes coincide with the windows forms Keys enumeration (beware though some do not match up, such as the number pad keys):
 
Dim vkCode As Integer = Marshal.ReadInt32(lParam)
Dim key As Forms.Keys = CType(vkCode, Forms.Keys)

Open in new window




Best of luck.
0
 
LVL 1

Author Comment

by:H-SC
ID: 36903091
vvbigham,

This is great info, many thanks for your reply
0
 
LVL 1

Author Comment

by:H-SC
ID: 36903096
CodeCruiser,

I think that I am going with the second link that you posted.  It seems more adaptable to what I am needing.  It looks like it will work great.  many thanks.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36906370
Glad to help :-)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to retrieve a mysql date column that has 0000-00-00 in vb.net 8 43
write xml in vb.net 2 33
Get number of Files in Directory and Sub Directories 2 48
vb.net class 3 22
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question