forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Capturing multimedia keys from keyboard?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Aug 16, 2008 8:24 am    Post subject: Capturing multimedia keys from keyboard? Reply with quote

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
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Aug 18, 2008 1:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Mon Aug 18, 2008 5:30 pm    Post subject: Reply with quote

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 Smile
~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
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Aug 19, 2008 1:53 am    Post subject: Reply with quote

Pfffftttt.... I'm such a noob!~ Helps if I don't misspell the variable names, eh? Rolling Eyes Embarassed Laughing
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group