Solved

Check for Keyboard Key

Posted on 2006-06-27
1
674 Views
Last Modified: 2012-05-05
I am trying to write a vb.net application that watches for a specific key. When the key is pressed it performs a specific action. The problem is that i want to watch for this key while the program does not have focus and the program is in the system tray.

I found some code that kind of allows me to do this, but it is for blocking the OS from receiving these keys. In order to block them the code uses some pretty advanced API's and the entire computer hangs for a few seconds while the program is receiving those keys. I modified the code to perform an anction instead of blocking the keys, but the program still hangs often.

Is there an easier way to perfrom an action when a key is pressed if i don't want to block the OS from receiving the keys?
0
Comment
Question by:Paul S
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 50 total points
ID: 16998362
Three basic methods:

(1) Register a Hotkey:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21549775.html

(2) Use a low level keyboard hook:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21584180.html

(3) Use a timer to poll the keyboard state:
I don't recommend this approach...
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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 …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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