Intercepting 'multimedia keys'
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vc.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Steve McLellan
Hi,

Does anyone know if it's possible (and if so, how) to intercept presses on
'multimedia keys' you find on keyboards? Curiosity more than anything. Only
manufacturers seem to put their own random gubbins onto their keyboards, so
presumably there isn't any kind of standard. Obviously their applications
are capable of listening to the buttons so it's possible at some level.
Possibilities in either .NET or Win32 welcome (hence the cross post -
apologies).

Cheers!

Steve

Reply to this message...
 
    
William DePalo [MVP VC++] (VIP)
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

If the vendor is playing by the rules and if the o/s in question is ME, 2K,
XP or 2K+3, the simple thing to do is to respond to the WM_APPCOMMAND
message. At that point the keyboard software has mapped the keystroke
message into an application command like "Play" for example.

The standard keys on the enhanced keyboards are defined in <winuser.h>:

#define VK_BROWSER_BACK 0xA6
#define VK_BROWSER_FORWARD 0xA7
#define VK_BROWSER_REFRESH 0xA8
#define VK_BROWSER_STOP 0xA9
#define VK_BROWSER_SEARCH 0xAA
#define VK_BROWSER_FAVORITES 0xAB
#define VK_BROWSER_HOME 0xAC

#define VK_VOLUME_MUTE 0xAD
#define VK_VOLUME_DOWN 0xAE
#define VK_VOLUME_UP 0xAF
#define VK_MEDIA_NEXT_TRACK 0xB0
#define VK_MEDIA_PREV_TRACK 0xB1
#define VK_MEDIA_STOP 0xB2
#define VK_MEDIA_PLAY_PAUSE 0xB3
#define VK_LAUNCH_MAIL 0xB4
#define VK_LAUNCH_MEDIA_SELECT 0xB5
#define VK_LAUNCH_APP1 0xB6
#define VK_LAUNCH_APP2 0xB7

So, to answer your question "to intercept" them you could filter them while
processing WM_KEYDOWN which I think is what is done on 95 and 98. But you
may end up tripping over the keyboard manufacturer's software (like
Intellimouse, say) if you do that.

> Curiosity more than anything.

As Martha might say, curiosity is a good thing. <g> If you curiosity is not
yet sated, you might want to take a look here:

http://www.microsoft.com/whdc/device/input/w2kbd.mspx

Regards,
Will

Reply to this message...
 
    
Steve McLellan
"William DePalo [MVP VC++]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

On further investigation, it would appear that they're not playing by the
rules (or at least I'm not getting any APPCOMMAND message)... the bounders!
Oh well, I shall investigate further another time...

Steve

Reply to this message...
 
    
Steve McLellan
[Original message clipped]

In order, probably not, yep and OK.

[Original message clipped]

They'd better not get in my way! :-) Their software falls over all the time
like a twig in a stiff breeze anyway...
[Original message clipped]

Martha is, I'm afraid, lost to transatlantic language barrier or my total
lack of sleep :-) Thanks for the link - it looks... 'comprehensive' :)

Thanks!

Steve

Reply to this message...
 
    
Gabest
Watch out for the volume level changing keys, they are often abused (that's
how I see at least) to control the master level when put on speakers. Many
of the users feel confused and start searching for your support email
address if your application happens to trap them to change its own private
sound level, as applications should for good behaviour.

Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com