Export (0) Print
Expand All

Using Remote Control Input Outside of Windows Media Center

This topic describes the Windows commands generated by the remote control device driver and how to retrieve them so that your application can respond appropriately to input.

The following table shows the associated messages and keyboard equivalents for the compulsory and optional buttons on the remote control.

ButtonMessageCommandKeyboard equivalent
#To be determinedSHIFT+3
*To be determinedSHIFT+8
BackWM_APPCOMMANDAPPCOMMAND_BROWSER_BACKBACKSPACE
Chan/Page DownWM_APPCOMMANDAPPCOMMAND_MEDIA_CHANNEL_DOWNMINUS SIGN (-)

CTRL+MINUS SIGN

PAGE DOWN

Chan/Page UpWM_APPCOMMANDAPPCOMMAND_MEDIA_CHANNEL_UPPLUS SIGN (+) CTRL+SHIFT+PLUS SIGN

PAGE UP

ClearWM_KEYDOWNVK_ESCAPEESC
DetailsWM_INPUT
DownWM_KEYDOWNVK_DOWNDOWN ARROW
DVD AngleWM_INPUT
DVD AudioWM_INPUT
DVD MenuWM_INPUT
DVD SubtitleWM_INPUT
eHomeNot for use by applications.
EnterVK_RETURNENTER
FwdWM_APPCOMMANDAPPCOMMAND_MEDIA_FASTFORWARD CTRL+SHIFT+F
GuideWM_INPUT
LeftWM_KEYDOWNVK_LEFTLEFT ARROW
MuteWM_APPCOMMANDAPPCOMMAND_VOLUME_MUTEF8
My MusicWM_INPUT
My PicturesWM_INPUT
Recorded TVWM_INPUT
My TVWM_INPUT
My VideosWM_INPUT
Number keysWM_KEYDOWNVK_0 to VK_90 to 9
OEM1WM_INPUT
OEM2WM_INPUT
OKWM_KEYDOWNVK_RETURNENTER

SPACEBAR

PauseWM_APPCOMMANDAPPCOMMAND_MEDIA_PAUSECTRL+P
PlayWM_APPCOMMANDAPPCOMMAND_MEDIA_PLAYCTRL+SHIFT+P
RecordWM_APPCOMMANDAPPCOMMAND_MEDIA_RECORD CTRL+R
ReplayWM_APPCOMMANDAPPCOMMAND_MEDIA_PREVIOUSTRACKCTRL+B
RewindWM_APPCOMMANDAPPCOMMAND_MEDIA_REWIND
RightWM_KEYDOWNVK_RIGHTRIGHT ARROW
SkipWM_APPCOMMANDAPPCOMMAND_MEDIA_NEXTTRACKCTRL+F
StandbyWM_INPUT
StopWM_APPCOMMANDAPPCOMMAND_MEDIA_STOPCTRL+S
UpWM_KEYDOWNVK_UPUP ARROW
TV/JumpWM_INPUT
Vol DownWM_APPCOMMANDAPPCOMMAND_VOLUME_DOWNF9
Vol UpWM_APPCOMMANDAPPCOMMAND_VOLUME_UPF10

Buttons that generate WM_INPUT messages are defined according to the Human Interface Device (HID) specification. The following table shows the HID mapping of these buttons.

ButtonUsage pagePage nameCollection
usage ID
Button
usage ID
Details0x0CConsumer controls0x010x209 (AC properties)
DVD Angle0xFFBCVendor-defined0x880x4B
DVD Audio0xFFBCVendor-defined0x880x4C
DVD Menu0xFFBCVendor-defined0x880x24
DVD Subtitle0xFFBCVendor-defined0x880x4D
Guide0x0CConsumer controls0x010x8D (AC Program Guide)
My Music0xFFBCVendor-defined0x880x47
My Pictures0xFFBCVendor-defined0x880x49
My TV0xFFBCVendor-defined0x880x46
My Videos0xFFBCVendor-defined0x880x4A
OEM10xFFBCVendor-defined0x880x80
OEM20xFFBCVendor-defined0x880x81
Recorded TV0xFFBCVendor-defined0x880x48
Standby0x01Generic desktop0x800x82
TV/Jump0xFFBCVendor-defined0x880x25

To process WM_INPUT messages, the application must first register the devices from which it receives data. You can do this by using the Win32® function RegisterRawInputDevices. Each RAWINPUTDEVICE structure passed to this function specifies one usage page and usage.

The following example C++ code registers the device to receive input from the controls defined on the vendor-defined usage page that have a usage of 0x88:

RAWINPUTDEVICE Rid[1];

Rid[0].usUsagePage = 0xFFBC; 
Rid[0].usUsage = 0x88; 
Rid[0].dwFlags = 0;

if (RegisterRawInputDevices(Rid, 1, sizeof(Rid[0])) == FALSE) 
{
    ErrorExit();  // Add error-handling code here.
}

To identify the event that triggered a WM_INPUT message, your application must parse the data passed to the window procedure as the lParam parameter.

If you are using the Microsoft .NET Framework, you must implement the WndProc method to retrieve messages. The WndProc method is a member of the NativeWindow class found in the System.Windows.Forms namespace. The overridden method is called each time a new message is placed in the form's message queue. Before returning, the method must call the base WndProc method to ensure that unprocessed messages are handled properly.

The following C# code shows how to use the WndProc method to retrieve WM_KEYDOWN messages:

using System.Windows.Forms;
.
.
.
class Form1Window : NativeWindow
{ 
  private const int WM_KEYDOWN = 0x0100;
  private int iChar;
  public Form1 form;
 
  protected override void WndProc(ref Message message)
  {
    // Handle the navigation and numeric buttons.
 
    if (message.Msg == WM_KEYDOWN)
    {
      iChar = message.WParam.ToInt32();
 
      switch(iChar)
      {
        case (int)Keys.D0:
          // Handle 0 key here.  
          break;
       // Insert more cases here.
.
.
.
      }  // End switch.
    }    // End key messages.
    base.WndProc(ref message);
  }      // End WndProc
}        // End class.

In the initialization code for the main form, you must create an instance of the Form1Window class and assign the main form to it, as follows:

public Form1()
{
  InitializeComponent();
  Form1Window win = new Form1Window();
  win.form = this;
  win.AssignHandle(this.Handle);
} 

To learn more about Human Interface Device (HID) and the structure of HID data, see the USB home page (http://www.usb.org).

See Also

Show:
© 2014 Microsoft