Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. using System.Runtime.InteropServices;
  2. using System.Windows.Forms;
  3.  
  4. namespace MediaHotkeys
  5. {
  6. internal class Program
  7. {
  8. [DllImport("user32.dll", SetLastError = true)]
  9. private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
  10.  
  11. private static void Main()
  12. {
  13. var KEYEVENTF_KEYUP = 0x0002;
  14.  
  15. //var mediaPlayPause = (byte) Keys.MediaPlayPause;
  16. //var mediaNextTrack = (byte) Keys.MediaNextTrack;
  17. var mediaPreviousTrack = (byte) Keys.MediaPreviousTrack;
  18.  
  19. keybd_event(mediaPreviousTrack, mediaPreviousTrack, 0, 0);
  20. keybd_event(mediaPreviousTrack, mediaPreviousTrack, KEYEVENTF_KEYUP, 0);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement