473,400 Members | 2,145 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,400 software developers and data experts.

How to detect left and right ALT keys?

Hi!

How can I detect left and right ALT keys pressed at the same time?

Thank you.

Louwaynne
Apr 23 '08 #1
2 1367
Hi!

How can I detect left and right ALT keys pressed at the same time?

Thank you.

Louwaynne

Hi!

I figured it out already. Just use this --> GetKeyState function through the P/Invoke layer.

Louwaynne
Apr 24 '08 #2
balame2004
142 100+
Hi!

I figured it out already. Just use this --> GetKeyState function through the P/Invoke layer.

Louwaynne
Hello,

Alternative way:

private Keys prevKey=null;

private void textBox1_KeyDown(object sender, KeyEventArgs e)
{

if (prevKey == Keys.Alt && e.Alt)
{
//your code
}

//saves currentkey
Keys prevKey=e.KeyCode;
}


-Balaji U
Apr 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John M | last post by:
Hi, In recently recieved some excellent advice which ebnabled me to make a form behave as a spreadsheet with respect to the down and up arrow keys. To develop this further I would like the right...
7
by: Seash | last post by:
Hi friends , here is the sample code private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == 13) //enter { txtbox2.Focus(); }
3
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
1
by: John Wright | last post by:
I need to backdoor my program for IT. I want to set a form so that if an IT staffer has the left ctrl key press and right click on a picturebox a hidden control will appear (a checkbox) to...
0
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can...
9
by: Anish G | last post by:
Hi, I have a visual basic application which needs to detect keyboard events. I want to it to detect all the arrow keys (Left, Right, Up, Down) and these should be detected at form level. I have...
0
by: Andrus | last post by:
I placed DateTimePicker to Winforms DataGridView using sample code from MSDN. When dropdown calendar is not opened, up and down arrow keys must move to previous/next row in grid. So I modified...
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...
16
by: ImpactMan | last post by:
Need help to create an windows mobile application with a few buttons that when they are pressed/clicked they assign keys, like up, down, left, right. It is just like to create a "virtual d-pad",...
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...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.