| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Aug 16, 2008 8:24 am Post subject: Capturing multimedia keys from keyboard? |
|
|
Anyone know how to catch the key presses on them extended keys like "Pause", "Play", "Stop" and other keys associated with that?
I want to catch those so I can assign them to the XMPlay audio player.
Thanks,
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Aug 18, 2008 1:51 pm Post subject: |
|
|
Garrett,
Try using the GetAsyncKeyState with the following values.
| Code: |
%%VK_VOLUME_MUTE = $AD
# Windows 2000/XP: Volume Mute key
%%VK_VOLUME_DOWN = $AE
# Windows 2000/XP: Volume Down key
%%VK_VOLUME_UP = $AF
# Windows 2000/XP: Volume Up key
%%VK_MEDIA_NEXT_TRACK = $B0
# Windows 2000/XP: Next Track key
%%VK_MEDIA_PREV_TRACK = $B1
# Windows 2000/XP: Previous Track key
%%VK_MEDIA_STOP $B2
# Windows 2000/XP: Stop Media key
%%VK_MEDIA_PLAY_PAUSE = $B3
# Windows 2000/XP: Play/Pause Media key
LoadLib user32.dll
%R = @lib(user32,GetAsyncKeyState,INT:,INT:%%VK_MEDIA_PLAY_PAUSE)
|
You will need to put GetAsyncKeyState in a tight loop to capture this way.
Information about the GetAsyncKeyState function can be found here http://msdn.microsoft.com/en-us/library/ms646293.aspx
I found the virtual keycodes here http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx
But this will not get the state of those keys globally... I think CodeScript had a list of keyboard codes that would work with the VDS @HOTKEY() function which will trap key states globally. If I get a chance I will see if I can translate these Virtual Key codes to Scan codes. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Aug 18, 2008 5:30 pm Post subject: |
|
|
That is what I needed, and it mostly works, even when vds is not the app in focus at the time.
Mute and volume up didn't want to work for me though.
Thanks
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Aug 19, 2008 1:53 am Post subject: |
|
|
Pfffftttt.... I'm such a noob!~ Helps if I don't misspell the variable names, eh?  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
|