Partilhar via


charCode property

Gets the numeric key code of a key that is pressed.

 

Syntax

HRESULT value = object.get_charCode(* p);

Property values

Type: long

The numeric code of the key that is pressed.

Standards information

There are no standards that apply here.

Remarks

The IDOMKeyboardEvent::charCode property represents the character code during the HTMLFrameSiteEvents::onkeypress event and the unmodified scan code of the key during HTMLFrameSiteEvents::onkeydown and HTMLFrameSiteEvents::onkeyup events. To detect whether the Alt, Ctrl, Meta, or Shift key is also pressed, see the IDOMKeyboardEvent::altKey, IDOMKeyboardEvent::ctrlKey, IDOMKeyboardEvent::metaKey, or IDOMKeyboardEvent::shiftKey property of the event.

The IDOMKeyboardEvent::charCode property is provided for compatibility only. The latest version of the Document Object Model (DOM) Events specification defines a IDOMKeyboardEvent::key property instead.

See also

Reference

IDOMKeyboardEvent::char

IDOMKeyboardEvent::key

IDOMKeyboardEvent::keyCode

IDOMKeyboardEvent::which