Capturing Keyboard and Mouse Events

Windows Media Player SDK banner art

The EnableContextMenu and ClickToPlay properties provide for user input through the image window. If EnableContextMenu is true, right-clicking on the image window opens a context menu that gives the user access to many of the Windows Media Player control properties. When the ClickToPlay property is true, users can start Windows Media Player by clicking the image window.

To receive mouse movement and mouse click events, set the SendMouseMoveEvents and SendMouseClickEvents properties to true. Mouse events include the following:

  • MouseDown. Occurs when the user presses the mouse button.
  • MouseUp. Occurs when the user releases the mouse button.
  • MouseMove. Occurs when the user moves the mouse pointer.
  • Click. Occurs when the user clicks the mouse button while the pointer is over the Windows Media Player.
  • DblClick. Occurs when the user double-clicks the mouse button while the pointer is over the Windows Media Player.

To receive keyboard events, set the SendKeyboardEvents property to true. Keyboard events include the following:

  • KeyDown. Occurs when the user presses a key.
  • KeyUp. Occurs when the user releases a key.
  • KeyPress. Occurs when the user presses and releases a key.