Share via


Windows Media Player 11 SDK AxWindowsMediaPlayer.KeyDown Event (VB and C#) 

Windows Media Player SDK banner art

Previous Next

AxWindowsMediaPlayer.KeyDown Event (VB and C#)

The KeyDown event occurs when a key is pressed.

[Visual Basic]
Private Sub player_KeyDownEvent(
  sender As Object,
  e As _WMPOCXEvents_KeyDownEvent
) Handles player.KeyDownEvent

[C#]
private void player_KeyDownEvent(
  object sender,
  _WMPOCXEvents_KeyDownEvent e
)

Event Data

The handler associated with this event is of type AxWMPLib._WMPOCXEvents_KeyDownEventHandler. This handler receives an argument of type AxWMPLib._WMPOCXEvents_KeyDownEvent, which contains the following properties related to this event.

Property Description
nKeyCode System.Int16

Specifies which physical key is pressed. For possible values, see Remarks.

nShiftState System.Int16

A bit field with the least significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.

Remarks

The nKeyCode property specifies a physical key. The following tables show the possible values for the major keys on a standard keyboard.

Values for the main keys.

Key Value
A-Z 65-90
0-9 48-56
F1-F12 112-123
ESC 27
TAB 9
CAPS LOCK 20
SHIFT (left or right) 16
CTRL (left or right) 17
ALT (left or right) 18
SPACE 32
BACKSPACE 8
ENTER 13
Windows logo key, left 91
Windows logo key, right 92
Application key 93

Values for the number pad keys.

Key Value
0-9 96-105
NUM LOCK 144
DIVIDE (/) 111
MULTIPLY (*) 106
SUBTRACT (-) 109
ADD (+) 107
SEPARATOR (Enter) 108
DECIMAL (.) 110

Values for the navigation keys.

Key Value
INSERT 45
DELETE 46
HOME 36
END 35
PAGE UP 33
PAGE DOWN 34
UP ARROW 38
DOWN ARROW 40
LEFT ARROW 37
RIGHT ARROW 39

Requirements

Version: Windows Media Player 9 Series or later

Namespace: AxWMPLib

Assembly: AxInterop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next