| Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
|
The keyboard state - is Shift, Ctrl or Alt key pressed?
Question: How can I reliably detect the present keyboard state - whether the Shift, Ctrl or Alt key are pressed?Answer: You can use GetKeyState() as shown in the other example on this site () or use GetKeyboardState() which works with an array of 256 bytes. This one will work on all Windows platforms while GetKeyState() had problems on Windows ME.You can use this array also to update the state e.g. turn off a caps-lock. Use function SetKeyState() for this purpose.
Comments:
| |||||||||||||||||||||||