|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 Justin wrote:
> How can I upgrade this to detect multiple keystrokes? For example The API call you mention will tell you the state of any key on the keyboard, > CRTL + E 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 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
business layer, data access layer , presentation layer for asp.net using C#.net
Convert OEM to Unicode Dynamically load a form Raising an event from a user control Determine if app fails... Inherited form Name from Base Borderless Form How to manage a exception in a Aplications Questions, questions...... Start Menu or Autorun.INF? |
|||||||||||||||||||||||