I was looking at some various sample code for processing mouse click events in C++ using a Windows system message hook, and thought that this would be a great way to process key presses that are usually only sent to the system, such as CTRL, ALT, SHIFT, etc. I was wondering if someone has a complete list of input constants (like WM_RBUTTONDOWN
and WM_LBUTTONDOWN
) or knows where to find one. Specifically, I would like to know which message constants are for keyboard inputs.
Thanks
Asked
Active
Viewed 703 times
0

Nate Koppenhaver
- 1,676
- 3
- 21
- 31
-
1Perhaps you can grep the Windows header files for them? – Jeremy Friesner Mar 31 '11 at 01:29
-
Windows.h has them. What C++ compiler/IDE are you using? – Ken White Mar 31 '11 at 01:31
-
I will be using Qt and VS 2010. I said will, be cause I don't have them installed yet, because I tried to install Xubuntu (a Linux distrubution) and my boot sector died. X( – Nate Koppenhaver Mar 31 '11 at 03:14
-
Probably VS for Windows projects though. – Nate Koppenhaver Mar 31 '11 at 03:15
2 Answers
2
In addition to the link included in Donatalo's answer, this link goes to the list of keyboard constants - Virtual key codes, that I think you are looking for.

Dominik Grabiec
- 10,315
- 5
- 39
- 45
1
These constants are in winuser.h
, which is part of the Microsoft Platform SDK. If you have Visual Studio installed, you may also have the SDK installed (look inside C:\Program Files (x86)\Microsoft SDKs\Windows
). If not, you can download the latest version (v7.1) here.

James McNellis
- 348,265
- 75
- 913
- 977

Jon
- 428,835
- 81
- 738
- 806