Solved

Lock/Disable Keyboard VS2008 VB.NET

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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