Solved

Lock/Disable Keyboard VS2008 VB.NET

Posted on 2011-09-30
5
745 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now