![]() |
#1 |
Junior Member
Join Date: May 2010
Posts: 11
|
Lit of Winamp's CMD + WM_COMMAND
Using the command line interface to control Winamp
The simplest, easiest, least powerful way of controlling Winamp is to execute winamp.exe yourself. By simply calling winamp.exe with various command line options, you do a number of things. For example: code: (Adds C:\mp3\whatever.mp3 to the playlist of a running Winamp, if Winamp is running, otherwise it opens Winamp and plays it outright) code: (Creates a new instance of Winamp, even if Winamp is already running) code: (Plays the file C:\mp3\file.mp3, regardless of whether or not Winamp is open) code: (Opens Winamp with a different Window Class name "myclassname") As you might notice, what you can actually do using the command line interface is pretty limited. It is really easy to get started with, though. You can also specify multiple files and or directories on the command line, such as: code: Using Windows Messages to control Winamp Determining the Winamp window Winamp is a 32-bit Windows application. Having said that, we'll assume some basic knowledge of 32 bit Windows programming. Winamp can be controlled using the Windows Message system. Before you can send Winamp messages, you have to determine its Window Handle. There are two primary ways of doing that, one for external applications, and another for plug-ins. Plug-ins simply get passed a HWND to Winamp in their respective structures. The variable is usually named hwndWinamp or hwndParent. External applications can find the Winamp window using the following pieces of code: C/C++: code: VBasic code: Delphi Pascal code: Note that this code uses the FindWindow() function to find a window of any title whose class name is "Winamp v1.x". All versions of Winamp 1.x and 2.x have the class "Winamp v1.x", unless changed using the /CLASS= switch (see above). Note that if you want to run multiple Winamp's and easily tell the difference between them, you can use the /CLASS= switch. Message types Winamp understands Winamp responds to three messages in particular: WM_USER, WM_COMMAND, and WM_COPYDATA. WM_USER and WM_COPYDATA allow you to control some of the more advanced aspects of Winamp while WM_COMMAND lets you do simple things such as simulate the pause button being pressed. WM_COMMAND Messages tbc |
![]() |
![]() |
![]() |
#2 |
Junior Member
Join Date: May 2010
Posts: 11
|
WM_COMMAND Messages
code: |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|