Page 1 of 1

#PB_Shortcut_PlayPause and other media/special keys!

Posted: Fri May 20, 2005 7:30 pm
by Rescator
Code updated For 5.20+

I just noticed that AddKeyboardShortcut() on windows actually accept most (if not all) VK_ key codes.

So if you ever wanted to handle those nifty Play, Pause, Next Track, Previous Track, Mute, Volume up, Volume Down keys and so on.
This is how to do that:

Code: Select all

#PB_Shortcut_NextTrack=$B0
#PB_Shortcut_PrevTrack=$B1
#PB_Shortcut_Stop=$B2
#PB_Shortcut_PlayPause=$B3
It's that simple, just define the missing constants and you can do things like this:

Code: Select all

AddKeyboardShortcut(#Window,#PB_Shortcut_NextTrack,#NextTrack)
AddKeyboardShortcut(#Window,#PB_Shortcut_PrevTrack,#PrevTrack)
AddKeyboardShortcut(#Window,#PB_Shortcut_Stop,#Stop)
AddKeyboardShortcut(#Window,#PB_Shortcut_PlayPause,#PlayPause)
The full list can be found at:
http://msdn.microsoft.com/library/defau ... ycodes.asp
and also in the latest PSDK if you have that!

It's that easy, so now you have no excuse any more to not support "special" keys! :)

Posted: Fri May 20, 2005 9:32 pm
by Gansta93
Fred, don't you want to add it? It would be good... I'va asked me this question and found this post. :-D