Click here to Skip to main content
13,801,048 members
Click here to Skip to main content
Add your own
alternative version


28 bookmarked
Posted 1 Jul 2003
Licenced CPOL

Messagemod: A Winamp 3.x plugin

, 1 Jul 2003
Rate this:
Please Sign up or sign in to vote.
Adds the windowsmessage support to Winamp 3.x with a WAC plugin
<!-- Article image -->

Sample Image - WinAmpMessageMod.gif

<!-- Add the rest of your HTML here -->


Many people use Winamp as their main mp3 player, and some have switched from Winamp 2.xx to Winamp 3.xx. Since Winamp 2.xx used the simple WM_COMMAND, WM_USER and WM_COPYDATA to control play, pause, stop etc, many other programs could control Winamp too.

In the 3.xx version of Winamp, the windows-messages was removed from the player, as we know it. Messagemod is a plugin (WAC) that adds the old functionality. I usually program in MFC, so this library is primarily made with MFC.

Messagemod is not complete with ALL the functions, but it has the basics. If you don't want to learn how to code it yourself, just download the "Winamp 2x Plugin Manager" from Winamp's homepage, that will give you all the functionality that the old 2.xx has.

What is needed

Download the Wasabi SDK from

When you have installed (unpacked) it to somewhere (Default: C:\Wasabi SDK) please read the few text files under the \docs directory to get some info about the SDK before starting. (I'll guess that you won't find it useful now, but maybe later)

Now compile the projects:

  • \Studio - This is the BFC project (project file is not in the bfc directory). Output: bfc.lib
  • \Studio\waclient - Output: waclient.lib

Unpack the sourcecode in the directory: \Studio\Examples\MessageMod

Add waclient.lib and bfc.lib to the project.

Before you try to compile the, please check the paths in settings for debug and working folder. Also check the "Post-build step" and change it to your new paths. 

We use Winamp 3.x (studio.exe) as the debug component. (So we can get all the TRACE messages)

What is a WAC?

A WAC is just a renamed DLL file. I guess Nullsoft guys wanted to see the difference between a component and system dll's. :)

Using the code

MessageMod.cpp and MessageMod.h:

In these files we have 2 classes; CMessageModApp and WACNAME. I have let the WACNAME remain unchanged as they are in the examples. Just because it would be easy to compare with other examples. Thanks for the easy template Nullsoft.

The class CMessageModApp class takes care of the MFC bit of the project. The output is a shared DLL MFC dll compilation. 
The class WACNAME takes care of the Winamp 3.xx bit of the project. I've added some useful overrides like "runlevelcb_onShutdown", but it is kept as simple as possible.

Winamp 3.xx makes a window called "STUDIO". The old Winamp 2.xx made a window called "Winamp 1.x". To handle that I've made a dummy window that is named the same. The window created is global, and the handling of the WM-commands are also global.

It is the dummy window that does all the magic, look at the easy windowproc:

                            LPARAM lParam)
    case WM_CREATE:
      return 0;

    case WM_PAINT: //The window will show transparent, to avoid it:   
                   // A simple paint routine.
      RECT r;
      GetClientRect(hwnd, &r);

      BeginPaint(hwnd, NULL);
      FillRect(GetDC(hwnd), &r, (HBRUSH) GetStockObject(GRAY_BRUSH));
      EndPaint(hwnd, NULL);
      return 0;
    case WM_COMMAND: //This calls the HandleWMCommand routine to 
                     //handle Winamp stuff
      int res=HandleWMCommand(hwnd, wParam,lParam);
      return res;
    case WM_USER: //This calls the HandleWMUser routine to handle 
                  //Winamp stuff
      int res=HandleWMUser(hwnd, wParam,lParam);
      return res;
  return DefWindowProc(hwnd, uMsg, wParam, lParam); 
  //Default window message...

The functions HandleWMCommand and HandleWMUser handles the different messages. This article will not explain how to use the the Wasabi SDK. It will just show you how it is done. It takes some time to be able to handle the Wasabi. To learn it you'll have to work some hours. It is clever to use Winamps forums also.

When you have compiled the code and Winamp3 is started you must make a simple program to send WM_COMMAND and WM_USER messages to the dummy window.

HWND Winamp=::FindWindow("Winamp 1.x",NULL);


    Winamp=::FindWindow("Winamp 3.x",NULL);

::SendMessage(Winamp, WM_COMMAND, WINAMP_PLAY, NULL);

Now with this code above you should be able to press play from an other program. The WinampDefs.h is a complete list over commands. The comments here gives an overview of what is added or not.

Known issues

Many of the functions that is depending to be in the same process as Winamp. All of these functions has been removed, since pointers are not available through processes.

If messages are sent before the STUDIO window is created it will crash. Winamp 3.x loads the plug-ins before the main window.


Due lack of time many of the features are not implemented, but can easily been done. So if someone feels like finishing it, please do so. Mail me if you want to publish it here as updated code, with your credits of course! :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Lars [Large] Werner
Engineer A/S Norske Shell (Dutch Shell)
Norway Norway
Visit for my blog!
Retired programmer, Norway never had the jobs I wanted Smile | :)

You may also be interested in...

Comments and Discussions

Generalmessage in wmp Pin
rvasu26-Feb-06 4:55
memberrvasu26-Feb-06 4:55 
GeneralRe: message in wmp Pin
Lars [Large] Werner26-Feb-06 6:36
professionalLars [Large] Werner26-Feb-06 6:36 
GeneralWith Winamp5 this plugin is not needed Pin
vantassel26-Dec-03 17:03
membervantassel26-Dec-03 17:03 
GeneralRe: Difference between Winamp 3 and Winamp 5 Pin
Lars [Large] Werner26-Dec-03 21:46
professionalLars [Large] Werner26-Dec-03 21:46 
GeneralCan't compile Pin
vantassel26-Dec-03 11:31
membervantassel26-Dec-03 11:31 
GeneralRe: Can't compile Pin
vantassel26-Dec-03 12:27
membervantassel26-Dec-03 12:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.181215.1 | Last Updated 2 Jul 2003
Article Copyright 2003 by Lars [Large] Werner
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid