• Welcome to Valhalla Legends Archive.
 

adding winamp to bot

Started by LizArD, July 11, 2004, 03:15 AM

Previous topic - Next topic

LizArD

yes I have searched google for this...

I have winamp already in my bot however I do not know how to set commands such as play, stop, pause, and play "*" if there is already a post on this please redirect me to it, I have searched and found nothing.

btw i know im nub  :-[

DaRk1

Public Function command(text As String)
Dim commandStr() As String
commandStr = Split(text, " ", 2)
   Select Case (LCase(commandStr(0)))
       Case "play"
           'SendMessage to winamp
       Case "next"
           'SendMessage to winamp
       Case "back"
           'SendMessage to winamp
       Case "stop"
           'SendMessage to winamp
       Case "pause"
           'SendMessage to winamp
       Case Else
   End Select
End Function

Im not sure what your asking but that might help.
Also try http://forums.winamp.com/showthread.php?s=b1c3a85d9b35e1d1fa7c64d4579b8ce7&threadid=180297
or
http://forum.valhallalegends.com/phpbbs/index.php?board=45;action=display;threadid=5410 those might help too.

LizArD

what you gave me is good the
"Send to winamp"
however im a newb at VB, and .. I dont know what to replace the "send to winamp" with  :-\

DaRk1

Look at those two links and you should be able to figure it out. Ill give you a hint you use SendMessage().

hismajesty

Quote from: LizArD on July 11, 2004, 05:58 AM
what you gave me is good the
"Send to winamp"
however im a newb at VB, and .. I dont know what to replace the "send to winamp" with  :-\

Use SendMessage().

Eli_1

#5
I know it's big, but I thought it was hard to find this exact document on Winamp's website, and I also don't have anywhere to upload the file to, so I'll post the important parts.

And yes, I do know it's not in VB - boo hoo, it's an API call.

Quote
/* message used to sent many messages to winamp's main window.
** most all of the IPC_* messages involve sending the message in the form of:
**   result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*);
*/
#define WM_WA_IPC WM_USER
/* but some of them use WM_COPYDATA. be afraid.
*/

#define IPC_GETVERSION 0
/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
**
** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
*/

#define IPC_GETREGISTEREDVERSION 770


typedef struct {
 char *filename;
 char *title;
 int length;
} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA,
// and you get the nice desired result. if title is NULL, it is treated as a "thing",
// otherwise it's assumed to be a file (for speed)

#define IPC_PLAYFILE 100  // dont be fooled, this is really the same as enqueufile
#define IPC_ENQUEUEFILE 100
/* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play
** as the lpData. Just enqueues, does not clear the playlist or change the playback
** state.
*/


#define IPC_DELETE 101
#define IPC_DELETE_INT 1101 // don't use this, it's used internally by winamp when
                           // dealing with some lame explorer issues.
/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
** Use IPC_DELETE to clear Winamp's internal playlist.
*/


#define IPC_STARTPLAY 102   // starts playback. almost like hitting play in Winamp.
#define IPC_STARTPLAY_INT 1102 // used internally, don't bother using it (won't be any fun)


#define IPC_CHDIR 103
/* sent as a WM_COPYDATA, with IPC_CHDIR as the dwData, and the directory to change to
** as the lpData.
*/


#define IPC_ISPLAYING 104
/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
** If it returns 1, it is playing. if it returns 3, it is paused,
** if it returns 0, it is not playing.
*/


#define IPC_GETOUTPUTTIME 105
/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
** returns the position in milliseconds of the current track (mode = 0),
** or the track length, in seconds (mode = 1). Returns -1 if not playing or error.
*/


#define IPC_JUMPTOTIME 106
/* (requires Winamp 1.60+)
** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
** IPC_JUMPTOTIME sets the position in milliseconds of the
** current song (approximately).
** Returns -1 if not playing, 1 on eof, or 0 if successful
*/

#define IPC_GETMODULENAME 109
#define IPC_EX_ISRIGHTEXE 666
/* usually shouldnt bother using these, but here goes:
** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal
** flag gets set, which if you send a normal WM_WA_IPC message with
** IPC_EX_ISRIGHTEXE, it returns whether or not that filename
** matches. lame, I know.
*/

#define IPC_WRITEPLAYLIST 120
/* (requires Winamp 1.666+)
** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
**
** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
** and returns the current playlist position.
** Kinda obsoleted by some of the 2.x new stuff, but still good for when
** using a front-end (instead of a plug-in)
*/


#define IPC_SETPLAYLISTPOS 121
/* (requires Winamp 2.0+)
** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
** IPC_SETPLAYLISTPOS sets the playlist position to 'position'. It
** does not change playback or anything, it just sets position, and
** updates the view if necessary
*/


#define IPC_SETVOLUME 122
/* (requires Winamp 2.0+)
** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
*/


#define IPC_SETPANNING 123
/* (requires Winamp 2.0+)
** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
*/


#define IPC_GETLISTLENGTH 124
/* (requires Winamp 2.0+)
** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
** IPC_GETLISTLENGTH returns the length of the current playlist, in
** tracks.
*/


#define IPC_GETLISTPOS 125
/* (requires Winamp 2.05+)
** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
** only faster since it doesn't have to write out the list. Heh, silly me.
*/


#define IPC_GETINFO 126
/* (requires Winamp 2.05+)
** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
** IPC_GETINFO returns info about the current playing song. The value
** it returns depends on the value of 'mode'.
** Mode      Meaning
** ------------------
** 0         Samplerate (i.e. 44100)
** 1         Bitrate  (i.e. 128)
** 2         Channels (i.e. 2)
** 3 (5+)    Video LOWORD=w HIWORD=h
** 4 (5+)    > 65536, string (video description)
*/


#define IPC_GETEQDATA 127
/* (requires Winamp 2.05+)
** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
** IPC_GETEQDATA queries the status of the EQ.
** The value returned depends on what 'pos' is set to:
** Value      Meaning
** ------------------
** 0-9        The 10 bands of EQ data. 0-63 (+20db - -20db)
** 10         The preamp value. 0-63 (+20db - -20db)
** 11         Enabled. zero if disabled, nonzero if enabled.
** 12         Autoload. zero if disabled, nonzero if enabled.
*/


#define IPC_SETEQDATA 128
/* (requires Winamp 2.05+)
** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
** IPC_SETEQDATA sets the value of the last position retrieved
** by IPC_GETEQDATA. This is pretty lame, and we should provide
** an extended version that lets you do a MAKELPARAM(pos,value).
** someday...

 new (2.92+):
   if the high byte is set to 0xDB, then the third byte specifies
   which band, and the bottom word specifies the value.
*/

#define IPC_ADDBOOKMARK 129
/* (requires Winamp 2.4+)
** Sent as a WM_COPYDATA, using IPC_ADDBOOKMARK, adds the specified
** file/url to the Winamp bookmark list.
*/
/*
In winamp 5+, we use this as a normal WM_WA_IPC and the string:

 "filename\0title\0"

 to notify the library/bookmark editor that a bookmark
was added. Note that using this message in this context does not
actually add the bookmark.
do not use :)
*/


#define IPC_INSTALLPLUGIN 130
/* not implemented, but if it was you could do a WM_COPYDATA with
** a path to a .wpz, and it would install it.
*/


#define IPC_RESTARTWINAMP 135
/* (requires Winamp 2.2+)
** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
*/


#define IPC_ISFULLSTOP 400
/* (requires winamp 2.7+ I think)
** ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP);
** useful for when you're an output plugin, and you want to see
** if the stop/close is a full stop, or just between tracks.
** returns nonzero if it's full, zero if it's just a new track.
*/


#define IPC_INETAVAILABLE 242
/* (requires Winamp 2.05+)
** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp.
*/


#define IPC_UPDTITLE 243
/* (requires Winamp 2.2+)
** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
** IPC_UPDTITLE will ask Winamp to update the informations about the current title.
*/


#define IPC_REFRESHPLCACHE 247
/* (requires Winamp 2.2+)
** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
** IPC_REFRESHPLCACHE will flush the playlist cache buffer.
** (send this if you want it to go refetch titles for tracks)
*/


#define IPC_GET_SHUFFLE 250
/* (requires Winamp 2.4+)
** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
**
** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
*/


#define IPC_GET_REPEAT 251
/* (requires Winamp 2.4+)
** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
**
** IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
*/


#define IPC_SET_SHUFFLE 252
/* (requires Winamp 2.4+)
** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
**
** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
*/


#define IPC_SET_REPEAT 253
/* (requires Winamp 2.4+)
** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
**
** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)
*/


#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable
/* (requires Winamp 2.9+)
** SendMessage(hwnd_winamp,WM_WA_IPC,enable?0:0xdeadbeef,IPC_MBOPENREAL);
** sending with 0xdeadbeef as the param disables all winamp windows,
** any other values will enable all winamp windows.
*/


#define IPC_GETWND 260
/* (requires Winamp 2.9+)
** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND);
** returns the HWND of the window specified.
*/
 #define IPC_GETWND_EQ 0 // use one of these for the param
 #define IPC_GETWND_PE 1
 #define IPC_GETWND_MB 2
 #define IPC_GETWND_VIDEO 3
#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND



I don't remember exactly, because it's been a long time since I cared enough to add Winamp support, but I think these were the ones I used most often.

Quote
/*
** Finally there are some WM_COMMAND messages that you can use to send
** Winamp misc commands.
**
** To send these, use:
**
** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
*/

#define WINAMP_OPTIONS_EQ               40036 // toggles the EQ window
#define WINAMP_OPTIONS_PLEDIT           40040 // toggles the playlist window
#define WINAMP_VOLUMEUP                 40058 // turns the volume up a little
#define WINAMP_VOLUMEDOWN               40059 // turns the volume down a little
#define WINAMP_FFWD5S                   40060 // fast forwards 5 seconds
#define WINAMP_REW5S                    40061 // rewinds 5 seconds

// the following are the five main control buttons, with optionally shift
// or control pressed
// (for the exact functions of each, just try it out)
#define WINAMP_BUTTON1                  40044
#define WINAMP_BUTTON2                  40045
#define WINAMP_BUTTON3                  40046
#define WINAMP_BUTTON4                  40047
#define WINAMP_BUTTON5                  40048
#define WINAMP_BUTTON1_SHIFT            40144
#define WINAMP_BUTTON2_SHIFT            40145
#define WINAMP_BUTTON3_SHIFT            40146
#define WINAMP_BUTTON4_SHIFT            40147
#define WINAMP_BUTTON5_SHIFT            40148
#define WINAMP_BUTTON1_CTRL             40154
#define WINAMP_BUTTON2_CTRL             40155
#define WINAMP_BUTTON3_CTRL             40156
#define WINAMP_BUTTON4_CTRL             40157
#define WINAMP_BUTTON5_CTRL             40158

#define WINAMP_FILE_PLAY                40029 // pops up the load file(s) box
#define WINAMP_FILE_DIR                 40187 // pops up the load directory box
#define WINAMP_OPTIONS_PREFS            40012 // pops up the preferences
#define WINAMP_OPTIONS_AOT              40019 // toggles always on top
#define WINAMP_HELP_ABOUT               40041 // pops up the about box :)

#define ID_MAIN_PLAY_AUDIOCD1           40323 // starts playing the audio CD in the first CD reader
#define ID_MAIN_PLAY_AUDIOCD2           40323 // plays the 2nd
#define ID_MAIN_PLAY_AUDIOCD3           40323 // plays the 3nd
#define ID_MAIN_PLAY_AUDIOCD4           40323 // plays the 4nd


Edit: You'll have to go find out what WM_COMMAND and WM_USER is equal to with Google.

Edit: I don't remember how you get the handle to Winamp's window, but I believe it's something like:
winamp_hwnd = FindWindow("Winamp 1.x", vbNullString)

Grok

Since you DID find the it on winamp's website, you could have just linked to the document.

Meh

I dont me too sound rude but he did say he couldnt find exact document.

hismajesty

Quote from: Meh on July 12, 2004, 02:55 PM
I dont me too sound rude but he did say he couldnt find exact document.

No, he said he had trouble finding it.

Eli_1

The information is no longer on their webpage in such a way that you can just go there and read it. You must first download their SDK and search through the files included in the .zip untill you find the document.

LizArD

#define IPC_STARTPLAY 102  // starts playback. almost like hitting play in Winamp.

it never tells me what to add in (SendMessage)

LizArD

Also tell me if im doing this right so far

Public Function command(text As String)
Dim commandStr() As String
commandStr = Split(text, " ", 2)
   Select Case (LCase(commandStr(0)))
       Case "volume"
           SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME)
       Case Else
   End Select
End Function


LizArD

#12
sorry to keep asking however~~ to play a certain song say.. !play 1, this is the code i was given above.

#define IPC_ENQUEUEFILE 100
/* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play
** as the lpData. Just enqueues, does not clear the playlist or change the playback
** state.
*/


#define WINAMP_FILE_PLAY                40029 // pops up the load file(s) box


// I came out with//

SendMessage(hwnd_winamp, WM_COPYDATA,IPC_PLAYFILE,40029);


the only reason i feel that is not right is because "pops up the load file(s) box

Banana fanna fo fanna

IPC_PLAYFILE is what you want.

LizArD

I dont understand what you mean. How is it what I "want" I see playfile in my code, does that mean its right or wrong.


ALSO! another thing =|

Public Function command(text As String)
Dim commandstr() As String
commandstr = Split(text, " ", 2)
   Select Case (LCase(commandstr(0)))
       Case "vol"
           ret = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
       Case "volume"
           ret = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
       Case "next"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)
       Case "play"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
       Case "stop"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0)
       Case "pause"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0)
       Case "back"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0)
       Case Else
   End Select
End Function


This is what I came out with when finally trying out everything together. For some reason when I try to complile it says "Ambiguous name detected: command" it highlights Public Function command(text As String) note: for some reason it doesn't highlight the outer ) for "(text As String)" I dont know why it is doing this =X