Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: JaMi on January 15, 2003, 06:44 PM

Title: Winamp Control
Post by: JaMi on January 15, 2003, 06:44 PM
Could anyone hook me up with a halfway decent wimamp mod for Vb? I've tried 2 or 3 different ones but they are overly buggy, and have the tendecy to produce mass error boxes, any help would be appreciated
Title: Re: Winamp Control
Post by: Mesiah / haiseM on January 15, 2003, 07:58 PM
just use an api spy and make ur own, its way more fun!
Title: Re: Winamp Control
Post by: indulgence on January 15, 2003, 11:21 PM
There is documentation on how to interact with Winamp 2.x at winamp dev site...

You just use SendMessage... really ez
Title: Re: Winamp Control
Post by: Yoni on January 16, 2003, 04:04 AM
A year (exactly) old, but it should still work:
http://www.valhallalegends.com/yoni/SampleHDL.zip
Title: Re: Winamp Control
Post by: JaMi on January 16, 2003, 05:50 AM
thanx for the effort yoni, but that was for c++ and probablly wouldnt mesh together with the rest of my vb project very well :p
Title: Re: Winamp Control
Post by: iago on January 16, 2003, 05:59 AM
hmm.. I have one written in C++, but all it is is a few SendMessage calls.. I'll find you the source when I get home tonight, if you want.

All you have to do is declare SendMessage in VB, and the rest translates very nicely.
Title: Re: Winamp Control
Post by: iago on January 17, 2003, 08:44 AM
Ok, sorry I took so long, I forgout about you :P

This is in c++, but it's really easy to convert it; all you really need are the SendMessages, and I would very much suggest you DO NOT do it this way, with the strcmp() at every line; that's just stupid, and I have to fix it :)

Without further ado, here is, quite possibly, the worst c++ code you'll ever see:

#define WS_VOLUMEUP 40058
#define WS_VOLUMEDOWN 40059
#define WS_PREV 40044
#define WS_NEXT 40048
#define WS_PLAY 40045
#define WS_PAUSE 40046
#define WS_STOP 40047
#define WS_FFWD 40060
#define WS_RWND 40061
#define MAX 128

bool Winamp(char *command)
{
      //A return value of 1 indicates good
      //0 means bad

      if(!(strcmp(command, "next")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_NEXT, NULL);
            command = "song";
      }
      else if(!(strcmp(command, "prev")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_PREV, NULL);
            command = "song";
      }
      else if(!(strcmp(command, "volup")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_VOLUMEUP, NULL);
            return 1;
      }
      else if(!(strcmp(command, "voldown")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_VOLUMEDOWN, NULL);
            return 1;
      }
      else if(!(strcmp(command, "play")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_PLAY, NULL);
            command = "song";
      }
      else if(!(strcmp(command, "pause")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_PAUSE, NULL);
            return 1;
      }
      else if(!(strcmp(command, "stop")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_STOP, NULL);
            return 1;
      }
      else if(!(strcmp(command, "ffwd")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_FFWD, NULL);
            return 1;
      }
      else if(!(strcmp(command, "rwnd")))
      {
            SendMessage(FindWindow("Winamp v1.x", NULL), WM_COMMAND, WS_RWND, NULL);
            return 1;
      }

      if(!strcmp(command, "song"))
      {
            char title[MAX];

            GetWindowText(FindWindow("Winamp v1.x", NULL), title, MAX);
            DisplayOnScreen(title);
            return 1;
      }
      return 0;
}
Title: Re: Winamp Control
Post by: JaMi on January 17, 2003, 08:59 AM
lol thank ya much that works rather well, with apispy + that id say i managed to make it work well enough that i dont get error's all the time anymore :p umm and since im on the topic, any help with accessing winamp's playlist for like searching through it for a certain song? or have i just not tinkered with the apispy long enough?
Title: Re: Winamp Control
Post by: Atom on January 17, 2003, 02:43 PM
tinker more. If that spy doesnt make it INCREDIBLY EASY ENOUGH for you then use patorjk's api spy, www.patorjk.com

it even generates the code for you, although the code isnt the cleanest
Title: Re: Winamp Control
Post by: Mesiah / haiseM on January 17, 2003, 05:25 PM
IIRC, winamp doesnt show the name of the song in the list, just the number, so youll only be able to search and play by its position in the playlist...
Title: Re: Winamp Control
Post by: JaMi on January 17, 2003, 09:08 PM
erm chewbot has `play *saliva*    type command so if thats not coming from winamp wheres it coming from?
Title: Re: Winamp Control
Post by: Yoni on January 18, 2003, 02:52 AM
QuoteA year (exactly) old, but it should still work:
http://www.valhallalegends.com/yoni/SampleHDL.zip
erm... *tries to figure out why I posted this here*
HDLs have nothing to do with winamp? ???
Title: Re: Winamp Control
Post by: iago on January 18, 2003, 09:26 AM
Well, you CAN use an HDL to control Winamp (maybe provide an even easier wrapper to catch messages), but it looks to me like you're just advertising :P