Science, Tech, Math › Computer Science Virtual Key Codes Used by Windows Print Biggie Productions/The Image Bank/Getty Images Computer Science Delphi Programming Delphi Tutorials Advanced PHP Programming Perl Python Java Programming Javascript Programming C & C++ Programming Ruby Programming Visual Basic View More By Zarko Gajic Zarko Gajic Computer Science Expert MSCS, Computer Science, University of Osijek Zarko Gajic is experienced in SQL and has working knowledge of DB systems such as MS SQL Server, Firebird, Interbase, and Oracle. He is also proficient in XML, DHTML, and JavaScript. Learn about our Editorial Process Updated on May 30, 2019 Windows defines special constants for each key the user can press. The virtual-key codes identify various virtual keys. These constants can then be used to refer to the keystroke when using Delphi and Windows API calls or in an OnKeyUp or OnKeyDown event handler. Virtual keys mainly consist of actual keyboard keys, but also include "virtual" elements such as the three mouse buttons. Delphi defines all constants for Windows virtual key codes in the Windows unit. Keyboard and VK Codes Here are some of the Delphi articles that deal with the keyboard and VK codes: Read More Understanding and Processing Keyboard Events in Delphi By Zarko Gajic Keyboard SymphonyDelphi For Beginners: Get familiar with the OnKeyDown, OnKeyUp, and onKeyPress event procedures to respond to various key actions or handle and process ASCII characters along with other special purpose keys. How to Translate a Virtual Key Code into a CharacterWindows defines special constants for each key the user can press. The virtual-key codes identify various virtual keys. In Delphi, the OnKeyDown and OnKeyUp events provide the lowest level of keyboard response. To use OnKeyDown or OnKeyUp to test for keys the user presses, you must use Virtual key codes to get the key pressed. Here's how to translate the virtual key code to the corresponding Windows character. Touch Me - I'm UntouchableIntercepting keyboard input for controls that cannot receive the input focus. Working with keyboard hooks from Delphi. ENTERing TabUsing the Enter key like a Tab key with Delphi controls. Abort a Loop by Pressing a KeyUse the VK_ESCAPE to abort a (for) loop. Use Arrow Keys to Move Between ControlsThe UP and DOWN arrow keys are virtually useless in edit controls. So why not use them for navigating between fields. Simulating Keystrokes from CodeA handy function to simulate the pressing of keyboard keys. Cite this Article Format mla apa chicago Your Citation Gajic, Zarko. "Virtual Key Codes Used by Windows." ThoughtCo, Aug. 26, 2020, thoughtco.com/virtual-key-codes-used-by-windows-4071289. Gajic, Zarko. (2020, August 26). Virtual Key Codes Used by Windows. Retrieved from https://www.thoughtco.com/virtual-key-codes-used-by-windows-4071289 Gajic, Zarko. "Virtual Key Codes Used by Windows." ThoughtCo. https://www.thoughtco.com/virtual-key-codes-used-by-windows-4071289 (accessed April 18, 2024). copy citation