473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Detect Multiple Keystrokes?

I'm creating a kiosk type application and this would be too simple for
someone to figure out:

Private Declare Function GetAsyncKeyState Lib "user32" ( ByVal vKey As
Short) As Short
Const VK_ESCAPE As Short = &H1B

How can I upgrade this to detect multiple keystrokes? For example CRTL + E

Any points in the right direction would be much appreciated. VB.NET 2005

Justin
Dec 19 '06 #1
2 5025
Justin wrote:
How can I upgrade this to detect multiple keystrokes? For example
CRTL + E
The API call you mention will tell you the state of any key on the keyboard,
so if you want to tell whether CTRL + E is pressed, check to see whether the
Ctrl key is pressed, and if it is, check to see whether the E key is
pressed. If it returns True for both, those two keys (among others,
possibly) are pressed.

Depending on what you're doing, it would probably be better to handle this
using the KeyDown events of a form or control, though:

\\\
If e.KeyCode = Keys.E AndAlso e.Control = True Then
MsgBox("Ctrl+E was pressed")
End If
///

If you add that to the form's KeyDown event and set the form's KeyPreview
date to True, this will fire every time Ctrl+E is pressed while the form has
focus.

--

(O)enone
Dec 19 '06 #2
It works great, Thanks!

Me.KeyPreview = True

Private Sub frmMain_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.E AndAlso e.Control = True Then
Me.Close()
End If
End Sub
Dec 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olli Piepponen | last post by:
Hi, I'm having a little problem catching keystrokes under Windows. I did a little research and found that with mscvrt.getch() one can cath a single key that is pressed. However this doesn't work...
1
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is...
7
by: Nick Calladine | last post by:
Hi On my form i have multiple select which all have an id value total1, total2, total3 etc so i am trying to detect how many there are and then use this to caculate a total. Is there a...
8
by: Hank Reed | last post by:
Hello, I have searched through dozens of old responses to this question but have been unable to make it work in my situation. I'm using Access 2000 We have a very old sticker printer on a...
5
by: Lucas Tam | last post by:
Hi all, Has anyone done this before? Send client side keystrokes to an application from a webpapge? This maybe more of a Javascript question. In short, I have an application on the client's...
3
by: Gunnar Syren | last post by:
I'm trying to implement a macro feature in my application by recording and playing back keystrokes. At first I thought it would be enough to catch KeyDown in my main form, but I soon realized that...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
0
by: Rajanikanth Jammalamadaka | last post by:
Hi! Can somebody tell me if there is an os independent way to detect a sequence of key strokes. For example, I want to start some other program once the user presses a couple of keys: ex: key a...
0
by: Rajanikanth Jammalamadaka | last post by:
Hi! I was able to do this in the following way: import os fKey= raw_input('') if fKey=='ab': print(os.listdir(os.getcwd()))
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.