API messages are quite nice to achieve things. Usually API messages are used for advanced effects, yet for some tools it's the way how user could trigger the action.
The example would be MPC-HC. If you have it, check of keyboard shortcut option and look for the column ID. Sorry for promoting here other tools, but I think they nicely add up to themselves, I use them both. So here's the script in AutoHotKey (for interested people, it will be explained)
Code: Select all
#IfWinActive ahk_class MediaPlayerClassicW ; remove it to make keys global
MPCHC(msg)
{
SendMessage,0x0111,msg,,,ahk_class MediaPlayerClassicW
}
Backspace::MPCHC(907)
Enter::MPCHC(908)
For such message, three fields would be needed:
* two integers* for message (in the example it sends 273 [0x0111 is hexadecimal] which means 'trigger user action' and then the proper code for the action
* window where message should be sent (XMBC has already great window selector, with classes, regexpes and wow, so it's basically done)
* as far as I remember, technically it was one integer, just high and low part, but it's been like 15 years since I had to go for such low level of developing, thankfully Oh well, but it was kinda fun and it made me understand how things works