[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to know if the ALT key is currently pressed?

Posted on 2000-01-29
2
Medium Priority
?
1,857 Views
Last Modified: 2013-11-20
I want to know if the ALT key is currently pressed.

To know if the CTRL is currently pressed i use:

if(GetKeyState(VK_CTRL) & 0x8000)
{
  ...
}

How to get the ALT key state? The Visual C++ doesn't recognise the VK_ALT constant.

Please, provide a short code as an answer. Thanks.
0
Comment
Question by:Mindo
2 Comments
 
LVL 30

Accepted Solution

by:
SteveGTR earned 120 total points
ID: 2418181
Do:

if (GetKeyState(VK_MENU)) // ALT key
{
  ...
}

Good Luck,
Steve

0
 
LVL 2

Author Comment

by:Mindo
ID: 2418523
Ok, i accept it as an answer. Please, take a look at my next question.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

591 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