Solved

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

Posted on 2000-03-27
6
321 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

10 Experts available now in Live!

Get 1:1 Help Now