Solved

How to press the play button in winamp by pressing a button on my program ?

Posted on 2000-03-27
6
324 Views
Last Modified: 2013-12-03
I have a simple program with a window and a button. I want to press this button and the winamp which is already opened starts playing as if I had press the play button on it. How can I do this ? What do I need to know ?
0
Comment
Question by:redhat092798
  • 3
  • 3
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2660603
You can use Spy or a similar utility to look at the parameters that are sent with the WM_COMMAND message that is produced when you press the play button on this winamp application.  Then you can make your application send a WM_COMMAND message with the same parameters to the winamp application.
0
 

Author Comment

by:redhat092798
ID: 2661158
" Then you can make your application send a
WM_COMMAND message with the same parameters to the winamp application."

I need a little more specifics from this sentence, namely,
1) You mean I do a SendMessage() or a PostMessage() ?

2)"to the winamp application" , I think I will need the handle or something of the winamp application, right ?

Thanks.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2661442
>> 1) You mean I do a SendMessage() or a PostMessage() ?
Either would be fine.

>> I think I will need the handle or something of the
>> winamp application, right ?
A handle to its main window.  You probably can use FindWindow() to find the window.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:redhat092798
ID: 2662742
I checked using Spy++ , when I press the play button on winamp, it sends  WM_COMMAND message and the
wparam  :  00009C6D
lParam    :  00000000

also pressing the stop button sends a WM_COMMAND messages,
wParam : 00009C6F
iParam   : 00000000

Is this the info I need ? Can you explain a little more please. A little code snippet would be nice.
Thanks.
 
0
 
LVL 22

Expert Comment

by:nietod
ID: 2663942
>> Is this the info I need ?
Yes.

You will need to get a handle to the window somehow, perhaps by using its title and the class name in FindWindow().

then you can try just doing

SendMessage(WndHnd,WM_COMMAND,0x00009c6d,0);

which specifies NULL for the control that is sending the message.  if that doesn't work, you'll need to get the controll's handle (each time the program runs, because this will change, where as the WPARAM value shoud, not change.) usign the control's id which is in the low word of the WPARAM   So something like

HWND CtrlHnd = GetDlgItem(WndHnd,0x9c6d);

then

SendMessage(Wndhnd,WM_COMMAND,0x00009c6d,(LPARAM) CtrlHnd);
0
 

Author Comment

by:redhat092798
ID: 2671035
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now