![]() |
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 |
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.
|
Because I want the same app to control WMP and iTunes and anything else that responds to media keys.
|
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? |
RegisterHotKey is the win32 api used and Winamp doesn't handle wm_appcommand messages, just wm_command and wm_user.
-daz |
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 :igor: |
Quote:
|
| All times are GMT. The time now is 20:58. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.