473,626 Members | 3,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3841
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud******** ******@TK2MSFTN GP15.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_FORW ARD 0xA7
#define VK_BROWSER_REFR ESH 0xA8
#define VK_BROWSER_STOP 0xA9
#define VK_BROWSER_SEAR CH 0xAA
#define VK_BROWSER_FAVO RITES 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_T RACK 0xB0
#define VK_MEDIA_PREV_T RACK 0xB1
#define VK_MEDIA_STOP 0xB2
#define VK_MEDIA_PLAY_P AUSE 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******** ******@TK2MSFTN GP15.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******** ******@TK2MSFTN GP15.phx.gbl...
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:ud******** ******@TK2MSFTN GP15.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******** ********@TK2MSF TNGP11.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******** ********@TK2MSF TNGP11.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****@freemai l.hu> wrote in message
news:uA******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.phx.gbl. ..
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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******** ******@TK2MSFTN GP10.phx.gbl...

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

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

Similar topics

0
1407
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 teaching in a hospital? Hamilton, Furnace, Duguid, Helms & Simpson (1999) reported that in the Faculty of Medicine and Medical Sciences at the University of Aberdeen, there were over 150 IT based learning resource in their curriculum and course...
0
2190
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 A P E R S The International Conference on Computational Intelligence and Multimedia Applications will be held at the University of Nevada, Las Vegas, USA on August 16-18, 2005. The conference will provide an
6
1797
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 color? Thanks a lot.
7
4087
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? Thanks! John
6
4887
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 the textbox's focus in the default button's event handler? Thanks in advance, Steve Murphy
2
2625
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 period character ("/", ".") but I can't find the named constant for these characters in the KEYS data type. Anyone know that their name is? Or a good workaround? Thanks, maxhodges
4
2184
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 working very nicely, and using the information in the comments below the article I've managed to completely hide the tab headers without resorting to "drawing over" them. What I've not managed to solve however is the fact that the user can press
2
4774
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, joystick usage, and mouse usage inputs very easily at a global level or at application levels by watching applications for events within the applications. I was wondering if there were any python libraries that provided
8
4124
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 information. Identify the tables and perform normalization to the tables to the required normal forms.
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.