473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Intercepting 'multimedia keys'

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
Nov 17 '05 #1
10 3827
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
Does anyone know if it's possible (and if so, how) to intercept presses on
'multimedia keys' you find on keyboards?
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
Nov 17 '05 #2
> news:ud**************@TK2MSFTNGP15.phx.gbl...
Does anyone know if it's possible (and if so, how) to intercept presses on 'multimedia keys' you find on keyboards?
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.
In order, probably not, yep and OK.

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

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.
They'd better not get in my way! :-) Their software falls over all the time
like a twig in a stiff breeze anyway...
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

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
Nov 17 '05 #3
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.
Nov 17 '05 #4

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
Does anyone know if it's possible (and if so, how) to intercept presses on 'multimedia keys' you find on keyboards?
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.


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
Nov 17 '05 #5
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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!
In that case you might want to have the Spy++ utility search for WM_KEYxxx
messages to all windows in the system.
Martha is, I'm afraid, lost to transatlantic language barrier or my total
lack of sleep :-) Thanks for the link - it looks... 'comprehensive' :)


Sorry. That's Martha Stewart, domestic diva, who is known to say "That's a
good thing."

Regards,
Will
Nov 17 '05 #6
> "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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!
In that case you might want to have the Spy++ utility search for WM_KEYxxx
messages to all windows in the system.


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


Sorry. That's Martha Stewart, domestic diva, who is known to say "That's a
good thing."


That's very positive. All our lifestyle divas seem to hate everyone (shows
like "What the hell are you wearing" and "Are you serious? You LIVE like
this?"). Odd. Ok, thanks for the tip... the quest continues!

Steve
Nov 17 '05 #7
"Gabest" <ga****@freemail.hu> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
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.


Hi,

I agree, they should. Fortunately, what I'm doing will hopefully never be
seen by anyone :-) It's just to satisfy my curiosity really. Thanks for the
tip though, definitely something to watching out for.

Cheers!

Steve
Nov 17 '05 #8

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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!


In that case you might want to have the Spy++ utility search for WM_KEYxxx
messages to all windows in the system.


That proved to do the trick... it appears Compaq have done away with all the
niceties and present a virtual key code of 00FF and scan code of <various>
for the 'special' keys, at least for this keyboard. Naughty!

Thanks for your help!

Steve
Nov 17 '05 #9
All of these devices use HID (human interface device). You can open these
devices directly (at least the multi-media buttons, the keyboard keys are
opened securely by Windows). You can then use the HidP and HidD APIs to
crack the reports.
Another option is to use WM_INPUT.

For details on using these APIs, see MSDN (look for WM_INPUT), or the
hclient sample in the DDK.
There are also several books written that include details on HID.

Randy

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
> Does anyone know if it's possible (and if so, how) to intercept presses on > 'multimedia keys' you find on keyboards?


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.


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

Nov 17 '05 #10
Hi,

OK, cheers for the advice. Will check it out.

Thanks!

Steve

"Randy Aull (MSFT)" <ra*****@microsoft.com> wrote in message
news:41********@news.microsoft.com...
All of these devices use HID (human interface device). You can open these
devices directly (at least the multi-media buttons, the keyboard keys are
opened securely by Windows). You can then use the HidP and HidD APIs to
crack the reports.
Another option is to use WM_INPUT.

For details on using these APIs, see MSDN (look for WM_INPUT), or the
hclient sample in the DDK.
There are also several books written that include details on HID.

Randy

--
This posting is provided "AS IS" with no warranties, and confers no rights. "Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
> Does anyone know if it's possible (and if so, how) to intercept
presses on
> 'multimedia keys' you find on keyboards?

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.


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


Nov 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric Armour | last post by:
All, I am in the final part of a Masters' degree in Multimedia. My dissertation begins. "Why should we think that Computer Assisted Learning (CAL) using multimedia would be effective in...
0
by: avinash | last post by:
International Conference on Computational Intelligence and Multimedia Applications, August 16-18, 2005 University of Nevada, Las Vegas, USA (www.iccima.org) F I R S T C A L L F O R P...
6
by: Valery Polyakov | last post by:
I am drawing lines with a semi-transparent color (alpha=100). When these lines intercept, the color becomes more intense. Is there a way to avoid this, so that I would get the same intensity of...
7
by: John | last post by:
Hi, Can anyone point me out how to intercept the keystrokes from a c# application that's not a active window? - intercepting the system wide keystrokes before it hits the target active window? ...
6
by: Steve Murphy | last post by:
I have a default button on a form, but when a certain textbox has focus, I want to intercept Enter key events and perform a different action. Is there an easy way to do this, or should I just check...
2
by: maxhodges | last post by:
I need to access some unicode characters from the keyboard for single textbox on a form I've built. I've done this before using the code below, but now I need to substitute the forward slash and...
4
by: Oenone | last post by:
I'm using a TabControl to facilitate a wizard-style form, using some of the techniques described here: http://www.codeproject.com/cs/miscctrl/WizardTab.asp For the most part I have this...
2
by: bryan rasmussen | last post by:
Hi, I've been looking at autohotkey to do some different usability hacks for windows http://www.autohotkey.com/ one of the benefits of this language is it allows one to catch keyboard usage,...
8
by: jumi | last post by:
Produce an E-R diagram, which documents the entities, attributes, relationships and cardinality involved in the Life Insurance Management System. Create a relational schema to hold the necessary...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.