title: windows media buttons on Remote Control dont work in WPF
body: <p>I have a remote control pointing at the PC / TV </p>
  
  <p>CTRL + P on the keyboard works and Plays / Pauses within the application.</p>
  
  <p>The remote control can Play / Pause in Media Player but it doesnt work in a WPF app.</p>
  
  <pre><code>    public MainWindow()
      {
          InitializeComponent();
          ModifierKeys mk = ((ModifierKeys)(ModifierKeys.Control | ModifierKeys.Shift));
          MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
          MyStop.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
          MyRewind.InputGestures.Add(new KeyGesture(Key.B,mk));
          MyFastForward.InputGestures.Add(new KeyGesture(Key.F,mk));
      }
  </code></pre>
  
  <p>My XAML is</p>
  
  <pre><code>&lt;Window.CommandBindings&gt;
      &lt;CommandBinding Command="{x:Static  RemoteControlTest:MainWindow.MyPlayPause}" Executed="MyPlayPauseEvent"/&gt;
      &lt;CommandBinding Command="{x:Static RemoteControlTest:MainWindow.MyStop}" Executed="MyStopEvent"/&gt;
      &lt;CommandBinding Command="{x:Static RemoteControlTest:MainWindow.MyFastForward}" Executed="MyFastForwardEvent" /&gt;
      &lt;CommandBinding Command="{x:Static RemoteControlTest:MainWindow.MyRewind}" Executed="MyRewindEvent" /&gt;
  &lt;/Window.CommandBindings&gt;
  </code></pre>
  
  <p>The events work for rewind and fast forward, but not for Play/Pause and Stop.</p>
  
  <p>I tried downloading Media Glass <a href="http://mediaglass.codeplex.com/" rel="nofollow">http://mediaglass.codeplex.com/</a> and this has the same issue on the remote when pressing CTRL + P</p>
  
  <p>I have found out that by applying the following</p>
  
  <pre><code> System.Windows.Input.Key wpfLeftKey = Key.LeftCtrl;
   var formsKey = (Forms.Keys)KeyInterop.VirtualKeyFromKey(wpfLeftKey);
  </code></pre>
  
  <p>I get different results from my output </p>
  
  <pre><code> Windows 32 = LControlKey 
   WPF = LeftControl
  </code></pre>
  
  <p>My thinking is that the remote control is programmed to send out LControlKey</p>
  
  <p>Therefore what I need to do is raise an event when the Win32 app records LControlKey and force the event to fire. Any suggestions. (After InitiliseComponent()?</p>
  
  <p>I could be completey of the beaten track here, or could be right. ???</p>