|
|
|
|
#1 |
|
Junior Member
Join Date: Dec 2001
Posts: 19
|
Media Keyboards?
Hi,
I'm trying to write an app that controls mp3 players by simulating the action of the media keyboards. Why? Well I want to be able to control a range of mp3 players with the one widget. Anyhow, on the face of it I should be able to do this by posting a WM_APPCOMMAND message and windows will ensure that if the current window doesn't handle it it will be dispatched via the WH_SHELL hook to non-active windows. Trouble is it doesn't work. For starters posting a WM_APPCOMMAND message controls WMP if it is not the active window, but it doesn't control Winamp. For seconds if I write an app that hooks WM_SHELL, it doesn't even respond to an actual real mdeia keyboard if the window is not active - never mind my WM_APPCOMMAND messages. So to cut a long story short I was wondering if anyone can tell me how Winamp hooks a media keyboard when it is non-active. I know how to configure Winamp to do it - what I really want to know is the actual code it uses to do the hooking. Thanks - Paul |
|
|
|
|
|
#2 |
|
Forum King
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
|
Why not just find the Winamp window reference, then fire a barrage of WM_COMMAND and WM_WA_IPC commands at it for control? That's what I'm doing for a very similar project.
"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!" See what I'm listening too. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Dec 2001
Posts: 19
|
Because I want the same app to control WMP and iTunes and anything else that responds to media keys.
|
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2005
Posts: 84
|
i'm not 100% of sure what you're asking for?
Is BroadcastSystemMessage() in the right direction. Or do you want to make an actual system hook? |
|
|
|
|
|
#5 |
|
Join Date: Sep 2003
Posts: 27,873
|
RegisterHotKey is the win32 api used and Winamp doesn't handle wm_appcommand messages, just wm_command and wm_user.
-daz |
|
|
|
|
|
#6 | |
|
Junior Member
Join Date: Dec 2001
Posts: 19
|
Quote:
For example, the msdn documentation for WM_APPCOMMAND msdn documentation for WM_APPCOMMAND imples that if the foreground app doesn't handle it the HSHELL_APPCOMMAND hook will be called. So I wrote a small test app to check this and it is certainly the case if the application is in the foreground, but it doesn't seem to work if the application is in the background. Furthermore I wrote another app that posted WM_APPCOMMAND and it controlled WMP when WMP was in the background but it doesn't control Winamp. So I was left wondering why hooking HSHELL_APPCOMMAND doesn't work, how WMP manages to hook my WM_APPCOMMAND messages and why Winamp doesn't manage to hook my WM_APPCOMMAND messages but does manage to hook the actual media keys on my keyboard when it isn't the active window
|
|
|
|
|
|
|
#7 | |
|
Junior Member
Join Date: Dec 2001
Posts: 19
|
Quote:
|
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|