Questions tagged [keycode]

A number linked with specific key on keyboard in many languages. May be different for one key depending on browser or platform. Use this tag for questions about the keycode property in a language.

Many languages associate different keys on the keyboard with different numbers, called "keycodes". The keycode is not to be confused with the ASCII character code, though there are some similarities. For example, JavaScript interprets an A keypress as 65 (ASCII code for capital "A") whether or not the Shift key was pressed or Caps Lock was enabled.

For more information about the JavaScript property, see

For more information about the C# KeyEventArgs.KeyCode property, see the Microsoft documentation.

839 questions
-2
votes
1 answer

How I can determine which key is pressed on keyboard? C++

How I can determine which key is pressed on keyboard in C++ using WINAPI? I try to use GetAsyncKeyState, but it work just for exactly one key, and I need to choose which one, but I need to get keyсode to it be send over tcp.
Riv Shiell
  • 31
  • 6
-2
votes
1 answer

How to store keycode's into a array and execute them?

I'm wondering if it's possible to store keyboard input history into a array and execute them at a later time? Basically I have a 3D grid game and a character moving around the grid. I want the user to enter all the movement instructions via right…
-3
votes
2 answers

Common Keycode For Screenshot in Javascript

Looking for a place that has the most common key code combination used for taking screenshots in Javascript. I know this is ultimately impossible to stop but I am trying to prevent screenshots from being taken. PrintScreen is impossible it stop I…
Devin Dixon
  • 11,553
  • 24
  • 86
  • 167
-3
votes
1 answer

How can I disable the browser numpad functions with Javascript/HTML

I want to use the numpad keycodes in my webpage, but there are already predefined functions for the numpad keys. For example, numpad key 4 referes to the keycode actions for the left arrow instead of just doing nothing. So I am just searching for…
-3
votes
1 answer

Unity, removing a keycode that is already selected

I have a script that has 2 public KeyCode variables the developer can set. What I want to accomplish is when say the dev selects as the player attack to be "Space" I would like to have the next public KeyCode selection "Interaction" to not include…
JoeyL
  • 1,295
  • 7
  • 28
  • 50
-3
votes
1 answer

Virtual key codes

I have a c++ console program. Ho can I simulate the "é" character ? Code: // Set up a generic keyboard event. ip.type = INPUT_KEYBOARD; ip.ki.wScan = 0; // hardware scan code for key ip.ki.time = 0; ip.ki.dwExtraInfo = 0; ip.ki.wVk = 0x45;…
T Jayceon
  • 11
  • 4
-3
votes
1 answer

How can I respond to a keyboard chord and replace the entered alpha key with a special one?

I want to, in a textbox on a WinForms app using C#, replace certain keyboard chords with special characters. For example, if the user enters "Ctrl+A", I want to insert into the textbox the character "á"; if the user enters "Ctrl+Shift+A", I want to…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
-4
votes
2 answers

What is the keycode for the open curly brace {

I'm creating a code-mirror instance with an autocomplete system that will activate on any key press. But whenever you type: { the auto complete still appears even though there is an if statement blocking key code 219 from showing the autocomplete.…
Username 2020
  • 101
  • 2
  • 10
-4
votes
1 answer

Ruby on Rails - KeyCode in Ruby

Is there a possibility to check if a key is pressed in Ruby? For example: In CoffeeScript/JavaScript, you are able to say: $(document).keypress event, -> alert event.keyCode Is this possible in Ruby as well? (I know, I could use NodeJS instead…
-4
votes
1 answer

Delphi Key Code 17 in FormKeyDown

I have this procedure and I get it's called when I press a key, and something else will happen when Key = 17, how can I know which key is it? procedure TFormPrincipal.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); begin if Key =…
sandiego
  • 151
  • 1
  • 4
  • 10
-5
votes
2 answers

how do I extend virtual key codes in the windows API (Win32)?

I want to create a new virtual key code in the windows API that I can assign scan codes to and read with GetKeyState but I cannot find a way to extend the enumeration. I have tried using "unknown" virtual key codes in sharpkeys but some applications…
Bots Fab
  • 139
  • 1
  • 9
-5
votes
1 answer

React Synthetic Event: How to capture if Enter key is pressed?

Why does the event passed below retain 'event.target' value but not 'event.code'? import React, { useState, useEffect } from 'react'; import moment from 'moment'; import { subscribeToTimer } from './api'; import './App.css'; function App() { …
Amith Raravi
  • 235
  • 3
  • 18
-5
votes
2 answers

Why does e.keyCode does not catch "{" in my textarea when typing on mobile phones

I am using an android phone and when I press any key in my textarea, it looks like that e.keycode does not function properly (It does not return true the keycode value for each key). But it always triggers when I press any key in my…
MMJM
  • 117
  • 1
  • 11
-6
votes
1 answer

e keyCode does not work for me

I have a problem My php file
', e)">
My javascript file function comment(id, e){alert(id); // WORK alert(e.keyCode); //DOES NOT WORK}
Abdou1221
  • 13
  • 3
1 2 3
55
56