View Full Version : MM Keyboards

March 5th, 2003, 11:53 PM
This topic has kindof two angles to it, so I'll cover both.

1) There's the generating a 'softkey' event so that, for instance, when you press next on the remote it sends a WM_APPCOMMAND next event to your specified program, or foreground process.
2) Then theres the receiving the 'softkey' event, and doing something else with it. Eg, press the stop button to close your favourite program.

The first case is fairly easy to do (Thanks to Kristans information)

Here are some of the lParams for your information:

Mute - 524288
Volume down - 589824
Volume up - 655360
Play / Pause - 917504
Stop - 851968
Previous track - 786432
Next track - 720896

For example, to send a next event to winamp, use the SendMessage plugin with the following information

Message Number: 793
wParam: 0
iParam: 720896

and target Class name "Winamp v1.x"
(Hint, if you match invisible tasks this will work when winamp is in the systray too)

Don't forget, this is generating a Next softkey event, and unless there is a specific reason to do so you're probably better just using winamps SDK to send a Winamp specific event. Specific reason may be that you want to control anything thats in the foreground which the softkeys do quite well. In my case, the softkeys get passed on from winamp to Hey Mr DJ if its loaded.

In the second case, it's very easy to grab a softkey event as you would a normal key, but the problem arises when you want to block that event from whatever application is in the foreground.

Girder can't do this because windows wont let it, but you can play some sneaky tricks, by editing the registry you can change the key from generating the 'softkey next' event to generating another key press. Eg F11 or something, which has obvious benefits.
You may have the problem I had, that you would like a next event sent to winamp when next is pressed, which works fine when winamp *doesn't* have window focus, but picks up on both the girder event and the window event. When it does, you can tell girder to 'Stop Processing' when winamp 'IsForeground'.
How handy :)

So, a bit more information on editing that registry. The area of interest is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Keyboard Layout
where you need to add a REG_BINARY called 'Scancode Map'
This is where things get interesting... you need to work out what data to put in it.
As posted by Ron, the following links are very useful

Its going to look something like this (Using mine as an example)

0000 00 00 00 00 00 00 00 00
0008 05 00 00 00 01 E0 32 E0
0010 02 E0 6C E0 03 E0 65 E0
0018 04 E0 66 E0 00 00 00 00

Now this is where i'm a little fuzzy, cos it was a long time ago now that I did it. The Microsoft website says the first value should be the "Size of the scancode map including header, in bytes" but it the Japanese site doesn't mention it, and I havn't included it. Who knows, but suffice to say it works for me without. The bunch of zeros on the first line are the two headers so we can leave them as they are.
Then the next value (05 00 00 00) is the number of entries including the null terminator. As you can see, I have four entries (Home, Mail, Search and Go keys on the Logitech Cordless Desktop Pro keyboard)
This page is quite useful to find out your scancodes:
I wanted to pick some codes that (afaict) are unused, so that other programs in windows wont be affected. So I figured I would use E001, E002, E003, and E004 (don't take my word on these, they might be used by your keyboard)

So the first entry is 01 E0 32 E0 which maps the Home button on my keyboard (E032) to E001. Then after all the entries comes the 00 00 00 00 null terminator.


March 6th, 2003, 12:07 AM
Great Info!

March 6th, 2003, 12:27 AM
I'm trying the first method, but so far no luck.

I'm using 3.2.8, SendMessage with a Target of Class Name=Winamp v1.x and a Exe=winamp.exe

Message # is set to 793

And nothing happens.

I've also tried Application Commands with a wParam=0 and lParam=720896, as well as trying to capture the keyboard code (According to Girder=B30000Z) and getting that to replay.

The one way I have gotten it to work is to select Command and use a wParam=40046 and a lParam=0. Why it works, I don't know, it's just what I could figure out from the capture screen.

Ideally, I'd just like to be able to fool the computer into thinking that I just pressed a key, but I'd take any general purpose solution. So I don't have to map seperate keys to different programs.

March 6th, 2003, 01:11 AM
Here is a GML file I made. It sends the Message like the regular keys do: to any Listening APP.


If you cant get the file, then I am probably in a game or something and turned off my server to kill some lag.


Oh, and if you can add any more buttons to it, do it, then send it back to me!

March 7th, 2003, 09:36 AM
O.k. I looked at the settings you provided and they were exactly what I was typing in. But because I fully believe that I can mess anything up I tried it out anyways. And nothing. :(

But that didn't seem right. :-? So I did some playing around a little bit. Up to this point I have been using WinAMP as my test since it's what I'm going to be using most but I want Media Player to work as well. So I loaded up MP and your settings DID work with it.

Now I just need to figure out what the keyboard is doing differently to work with both.... :-/

Maybe I should just hack the two of them together so that one button press called a Play/Pause for both commands.


March 7th, 2003, 01:48 PM
I dont suppose youre using windows 9x/nt are you?
This would explain your problems

March 7th, 2003, 05:26 PM
OS: XP Pro

March 7th, 2003, 05:47 PM
Winamp doesnt regularly support the keyboard MM keys.

March 7th, 2003, 07:01 PM
WinAMP 3 doesn't, WinAMP 2.X does

Using the keyboard works like a charm, finding how to trigger the same result in Girder is.... troublesome... :cry:

March 10th, 2003, 04:32 PM
I stand Corrected

March 10th, 2003, 04:42 PM
It was pretty much the number 1 reason I dropped WinAMP3...

...that and it sucks. :lol:

March 10th, 2003, 04:52 PM
Heh. I just use the Winamp 3 Plugin :P