I am currently in the process of creating a plug-in for an application, and im attempting to use the SendMessage/PostMessage function to control other applications via the host application. I have successfully coded control code for winamp using WM_COMMAND, and am now interested in coding something for Windows Media Player. I am aware that it accepts WM_APPCOMMAND messages to perform basic functions from special keyboards etc, but i seem to be unable to artificially reproduce this effect. I have been attempting to control it using FindWindow (this returns the correct handle) and SendMessage(mwphWnd, WM_APPCOMMAND, <wmphWnd or NULL>, APPCOMMAND_MEDIA_PLAY); with several variations for the value of lParam. I have used the Spy++ utility to spy on the message being sent to it via my keyboard (the function buttons on my keyboard effectively stop/pause/play wmp media) and found it to be using the message in an identical fashion to which i am using it. I have also tested using the SendMsg utility to ensure it is not the fault of my program (SendMsg also fails to control wmp given the same parameters mentioned previously).
I have referenced the following pages in my research: 1, 2 & 3. I am also aware of the method described in this post, but i would prefer not to make use of it for the reasons mentioned in the comments at the bottom of it.
If anyone has any ideas about what i might be doing wrong, or has any alternate methods i might try (using window messages only) I would really appreciate the suggestions.