WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Controlling Winamp Remotely

Keywords:   Winamp remote control

Question:

Has anyone done anything with controlling Winamp via API ?? I have a few machines at work, and one of them has a pretty large MP3 archive (all personally owned, of course). Unfortunately, this isn't my main PC, so if I ever want to skip a song or pause or anything I need to switch to that PC.

I know that Winamp accepts Windows Messages to control it, so I'm trying the following:


winid=WinIDGet("~3046")
IntControl(22, winid, "40046", "WM_COMMAND", test)
I've verified the winid, it is the correct window, and according to Winamp's site 40046 is the code to Pause/Unpause. Thanks in advance for any help!

Answer:

I don't know if this will work, but it appears to be what you are trying for:

winid=WinIDGet("~3046")
WM_COMMAND=273
IntControl(23, winid, WM_COMMAND, 40046, 0)
WM_COMMAND is a standard constant, defined as 273. WM_USER is 1024.

Question (cont'd):

Thank you for trying, but that didn't work. Would you happen to know the code for WM_USER. Is there an online reference that has these codes?

Answer:

WM_USER is defined as 0x0400.

Here is the Win32 API docs on it:


WM_USER
The WM_USER constant is used by applications to help 
define private messages, usually of the form
WM_USER+X, where X is an integer value. 

#define WM_USER 0x0400
Remarks
The following are the ranges of message numbers. 

Range Meaning 
0 through WM_USER – 1 Messages reserved for use by the system. 
WM_USER through 0x7FFF Integer messages for use by private window classes. 
WM_APP through 0xBFFF Messages available for use by applications. 
0xC000 through 0xFFFF String messages for use by applications. 
Greater than 0xFFFF Reserved by the system for future use. 


Message numbers in the first range (0 through WM_USER – 1) 
are defined by the system. Values in this
range that are not explicitly defined are reserved 
for future use by the system. 

Message numbers in the second range (WM_USER through 0x7FFF) 
can be defined and used by an application to send messages 
within a private window class. These values cannot be used 
to define messages that are meaningful throughout an application, 
because some predefined window classes already define values in 
this range. For example, predefined control classes such as 
BUTTON, EDIT, LISTBOX,and COMBOBOX may use these values. 
Messages in this range should not be sent to other applications
unless the applications have been designed to exchange messages 
and to attach the same meaning to the
message numbers. 

Message numbers in the third range (0x8000 through 0xBFFF) 
are available for application to use as private messages. 
Message in this range do not conflict with system messages. 

Message numbers in the fourth range (0xC000 through 0xFFFF) 
are defined at run time when an application calls the 
RegisterWindowMessage function to retrieve a message number 
for a string. All applications that register the same string 
can use the associated message number for exchanging messages. 
The actual message number, however, is not a constant and 
cannot be assumed to be the same between different sessions. 

Message numbers in the fifth range (greater than 0xFFFF) are 
reserved for future use by the system. 

Requirements 
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h; include windows.h.

Article ID:   W14620
Filename:   Controlling Winamp Remotely.txt
File Created: 2001:01:26:14:51:40
Last Updated: 2001:01:26:14:51:40