Solved

Lock/Disable Keyboard VS2008 VB.NET

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

11 Experts available now in Live!

Get 1:1 Help Now