Valhalla Legends Forums Archive | Visual Basic Programming | adding winamp to bot

AuthorMessageTime
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 :-[
July 11, 2004, 8:15 AM
DaRk1
[code]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
[/code]
Im not sure what your asking but that might help.
Also try http://forums.winamp.com/showthread.php?s=b1c3a85d9b35e1d1fa7c64d4579b8ce7&threadid=180297
or
https://davnit.net/bnet/vL/phpbbs/index.php?board=45;action=display;threadid=5410 those might help too.
July 11, 2004, 9:01 AM
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 :-\
July 11, 2004, 10:58 AM
DaRk1
Look at those two links and you should be able to figure it out. Ill give you a hint you use SendMessage().
July 11, 2004, 11:00 AM
hismajesty
[quote author=LizArD link=board=31;threadid=7655;start=0#msg69675 date=1089543490]
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 :-\
[/quote]

Use SendMessage().
July 12, 2004, 12:03 AM
Eli_1
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
[/quote]



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
[/quote]


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:
[code]winamp_hwnd = FindWindow("Winamp 1.x", vbNullString)[/code]
July 12, 2004, 2:47 PM
Grok
Since you DID find the it on winamp's website, you could have just linked to the document.
July 12, 2004, 6:04 PM
The-Rabid-Lord
I dont me too sound rude but he did say he couldnt find exact document.
July 12, 2004, 7:55 PM
hismajesty
[quote author=Meh link=board=31;threadid=7655;start=0#msg70004 date=1089662147]
I dont me too sound rude but he did say he couldnt find exact document.
[/quote]

No, he said he had trouble finding it.
July 12, 2004, 8:17 PM
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.
July 12, 2004, 10:29 PM
LizArD
[code]#define IPC_STARTPLAY 102 // starts playback. almost like hitting play in Winamp.[/code]

it never tells me what to add in (SendMessage)
July 17, 2004, 8:46 PM
LizArD
Also tell me if im doing this right so far

[code]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[/code]
July 17, 2004, 8:49 PM
LizArD
sorry to keep asking however~~ to play a certain song say.. !play 1, this is the code i was given above.

[code]#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);
[/code]

the only reason i feel that is not right is because "pops up the load file(s) box
July 17, 2004, 9:04 PM
St0rm.iD
IPC_PLAYFILE is what you want.
July 17, 2004, 9:43 PM
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 =|

[code]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[/code]

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 [code] Public Function command(text As String)[/code] note: for some reason it doesn't highlight the outer ) for "(text As String)" I dont know why it is doing this =X
July 17, 2004, 10:04 PM
Lobo.id
since your using a function you need to declare it, as which data type that fits your needs, of course the way it looks you might just want to do

[code]
Public sub command(byval text As String)
'winamp code here
End Sub
[/code]
July 18, 2004, 12:58 AM
LizArD
[code]Public Sub command(ByVal 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 Sub[/code]

this is my code now, it continues to tell me "Ambiguous name detected: command"

[code]Public Sub command(ByVal text As String)[/code]
July 18, 2004, 1:55 AM
LizArD
btw does anyone know if im donig this right? for example

[code]Case "next"
ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)[/code]

i should be using ret = " " " " etc.. right??
July 18, 2004, 2:07 AM
Lobo.id
You might want to Change Command to WinAmpCommand
July 18, 2004, 2:59 AM
LizArD
the bot seemed to compile soon, however when i tested on bnet didn't actually play the songs or change what could possibly be wrong?
July 18, 2004, 3:16 AM
Lobo.id
On the SendMessages Call's insted of doing

[code]ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
[/code]

try:

[code]Call SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
[/code]
July 18, 2004, 3:54 AM
LizArD
[code]Public Sub WinAmpcommand(ByVal text As String)
Dim commandstr() As String
commandstr = Split(text, " ")
Select Case (LCase(commandstr(0)))
Case "vol", "volume"
If UBound(commandstr) > 0 Then
If IsNumeric(commandstr(1)) = True Then
SendMessage hwnd_winamp, WM_WA_IPC, commandstr(1), IPC_SETVOLUME
End If
End If
Case "next"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0
Send "Winamp: Skipped forwards."
Case "play"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0
Send "Winamp: Play started."
Case "stop"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0
Send "Winamp: Play stopped."
Case "pause"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0
Send "Winamp: Play paused."
Case "back"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0
Send "Winamp: Skipped backwards."
End Select
End Sub[/code]

This is what i have, everything compiles good, just.. doesn't work on bnet. Any susgestions?
July 18, 2004, 5:49 AM
Adron
[quote author=LizArD link=board=31;threadid=7655;start=15#msg71111 date=1090129753]
This is what i have, everything compiles good, just.. doesn't work on bnet. Any susgestions?
[/quote]

You get the messages displayed, so you know the code executes? Set a breakpoint and verify that hwnd_winamp is ok. Also check for errors from sendmessage (return value + lastdllerror or something like that in VB).

Post your current definition of SendMessage too, maybe something's wrong with that.
July 18, 2004, 8:43 AM
LizArD
When I try to use .play on the bot, along with all of the other commands, it never sends text to battlenet. (my key is not muted I have checked) winamp never starts playing. My friend told me to do that checkpoint thing, i know how to set them just how do I check?


what do you mean by definition of sendmessage? i thought everything was in the code i gave =\
July 18, 2004, 9:27 AM
Adron
There should be a Declare Function SendMessage somewhere at the top of your program.

If you don't see the 'Send "Winamp: Play started." ', then the problem could quite probably be outside this code.

Set a breakpoint by moving the cursor to the line you want it on and hitting F9.


Start by setting a breakpoint on 'commandstr = Split(text, " ")'. Run the program, do .play, see if the breakpoint triggers. If it does, hit F8 to execute one line at a time and see where it goes.

If it goes out of the sub instead of down to the 'Case "play" ', hit F5 and do .play again. This time, point your mouse at 'text' and see what's in there. If that looks ok, execute a few lines down and check commandstr(0).
July 18, 2004, 9:38 AM
LizArD
[quote author=Adron link=board=31;threadid=7655;start=15#msg71130 date=1090143501]
There should be a Declare Function SendMessage somewhere at the top of your program.
[/quote]

I dont see it at the top of my source on that page, possibly located somewhere else? i'll do the checkpoint thing now ;]

I checked the 'checkpoint' and it never trigger when i accessed the command.
July 18, 2004, 9:50 AM
DarkLord
i Just finished adding some winamp commands to my bot(loadwinamp, play, stop, next, back, mp3)
if you want i can go dig it up for you(if you havent already figered it out that is)
PM me if you want it
July 18, 2004, 1:09 PM
Eli_1
[quote author=DarkLord link=board=31;threadid=7655;start=15#msg71148 date=1090156144]
i Just finished adding some winamp commands to my bot(loadwinamp, play, stop, next, back, mp3)
if you want i can go dig it up for you(if you havent already figered it out that is)
PM me if you want it
[/quote]

The whole reason we're all doing all this is because we want him to actually do it on his own. Don't just hand people code. He's doing fine, let him figure it out.
July 18, 2004, 5:32 PM
LizArD
[quote author=Adron link=board=31;threadid=7655;start=15#msg71130 date=1090143501]
There should be a Declare Function SendMessage somewhere at the top of your program.
[/quote]

I ran the checkpoints and they never lit up or anything, how should I declare the function SendMessage
July 18, 2004, 7:45 PM
Adron
[quote author=LizArD link=board=31;threadid=7655;start=15#msg71183 date=1090179925]
I ran the checkpoints and they never lit up or anything, how should I declare the function SendMessage
[/quote]

Don't worry about it until the breakpoints trigger. Find out where you're calling your WinAmpcommand function from and set some breakpoints around there, or post the code for that function.
July 18, 2004, 9:09 PM
LizArD
the breakpoitnts dont seem to be working..
i have set one on the following

[code]Public Sub WinAmpcommand(ByVal text As String)
commandstr = Split(text, " ")
Select Case (LCase(commandstr(0)))[/code]

wouldn't allow me to place one on [code] Dim commandstr() As String[/code]
July 18, 2004, 10:02 PM
hismajesty
That's because it's a declaration.
July 18, 2004, 10:17 PM
DarkLord
Alllll Righty then! :'(
July 18, 2004, 10:35 PM
LizArD
DarkLord, if you have done a winamp before, what do you think is wrong with my code?



[code]Public Sub WinAmpcommand(ByVal text As String)
Dim commandstr() As String
commandstr = Split(text, " ")
Select Case (LCase(commandstr(0)))
Case "vol", "volume"
If UBound(commandstr) > 0 Then
If IsNumeric(commandstr(1)) = True Then
Call SendMessage(hwnd_winamp, WM_WA_IPC, commandstr(1), IPC_SETVOLUME)
Send "Winamp: Volume set to " & commandstr(1)
End If
End If
Case "next"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0
Send "Winamp: Skipped forwards."
Case "play"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0
Send "Winamp: Play started."
Case "stop"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0
Send "Winamp: Play stopped."
Case "pause"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0
Send "Winamp: Play paused."
Case "back"
SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0
Send "Winamp: Skipped backwards."
End Select
End Sub



[/code]
July 18, 2004, 11:19 PM
LizArD
[code]Option Explicit
'All the Declarations
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessageCDS Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As COPYDATASTRUCT) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetMenuState Lib "user32" (ByVal hMenu As Long, ByVal wID As Long, ByVal wFlags As Long) As Long


Public Const WM_USER = &H400
Public Const WM_WA_IPC = WM_USER
Public Const WM_COPYDATA = &H4A
Public Const WM_GETTEXT = &HD
Public Const MF_BYCOMMAND = &H0
Public Const WU_MF_CHECKED = &H8

Public hwnd_winamp As Long
Public hMenuOptions As Long
Public hMenuWinamp As Long


Public Const IPC_DELETE = 101
Public Const IPC_ISPLAYING = 104
Public Const IPC_GETOUTPUTTIME = 105
Public Const IPC_JUMPTOTIME = 106
Public Const IPC_WRITEPLAYLIST = 120
Public Const IPC_SETPLAYLISTPOS = 121
Public Const IPC_SETVOLUME = 122
Public Const IPC_SETPANNING = 123
Public Const IPC_GETLISTLENGTH = 124
Public Const IPC_SETSKIN = 200
Public Const IPC_GETSKIN = 201
Public Const IPC_GETLISTPOS = 125
Public Const IPC_GETINFO = 126
Public Const IPC_GETEQDATA = 127
Public Const IPC_PLAYFILE = 100
Public Const IPC_GETPLAYLISTFILE = 211
Public Const IPC_CHDIR = 103

Public Const WINAMP_OPTIONS_EQ = 40036
Public Const WINAMP_OPTIONS_PLEDIT = 40040
Public Const WINAMP_VOLUMEUP = 40058
Public Const WINAMP_VOLUMEDOWN = 40059
Public Const WINAMP_FFWD5S = 40060
Public Const WINAMP_REW5S = 40061
Public Const WINAMP_BUTTON1 = 40044
Public Const WM_COMMAND = &H111
Public Const WINAMP_BUTTON2 = 40045
Public Const WINAMP_BUTTON3 = 40046
Public Const WINAMP_BUTTON4 = 40047
Public Const WINAMP_BUTTON5 = 40048
Public Const WINAMP_BUTTON1_SHIFT = 40144
Public Const WINAMP_BUTTON4_SHIFT = 40147
Public Const WINAMP_BUTTON5_SHIFT = 40148
Public Const WINAMP_BUTTON1_CTRL = 40154
Public Const WINAMP_BUTTON2_CTRL = 40155
Public Const WINAMP_BUTTON5_CTRL = 40158
Public Const WINAMP_FILE_PLAY = 40029
Public Const WINAMP_OPTIONS_PREFS = 40012
Public Const WINAMP_OPTIONS_AOT = 40019
Public Const WINAMP_HELP_ABOUT = 40041 'About Window
Public Const WINAMP_FILE_QUIT = 40001 'Quit WinAmp
Public Const WINAMP_URL_WINDOW = 40155 'URL Window
Public Const WINAMP_FORWARD_TEN = 40195 'Forward 10 tracks
Public Const WINAMP_BACK_TEN = 40197 'Back 10 tracks
Public Const WINAMP_SHADEMODE = 40064 'Shape Mode

'Winamp menu item ID's (used to monitor items checked state)
Public Const WINAMP_MENU_SHUFFLE = &H9C57 'Shuffle Button
Public Const WINAMP_MENU_REPEAT = &H9C56 'Repeat Button
Public Const WINAMP_MENU_TIMEELAPSED = &H9C65
Public Const WINAMP_MENU_TIMEREMAINING = &H9C66
Public Const WINAMP_MENU_ALWAYSONTOP = &H9C53
Public Const WINAMP_MENU_DOUBLESIZE = &H9CE5
Public Const WINAMP_MENU_EASYMOVE = &H9CFA
'Winamp Command Definitions
'PLAYBACK
Public Const WINAMP_SHUFFLE = 40023 'Shuffle Button truns on/off
Public Const WINAMP_REPEAT = 40022 'Repeat Button truns on/off
Public Const WINAMP_DOUBLESIZE = 40165
'Windows
Public Const WINAMP_WINDMAIN = 40258
Public Const WINAMP_WINDBROWSER = 40298


Public Type COPYDATASTRUCT
dwData As Long
cbData As Long
lpData As String
End Type

Public Type SONGTITLE
sName As String
sArtist As String
sTrackNumber As String
End Type
Public TrackTitle As SONGTITLE


Public Function FindWinamp() As Long
'Find winamp window
'Returns 1 if winamp is open, 0 if not
Dim hMenuSystem As Long

hwnd_winamp = FindWindow("Winamp v1.x", vbNullString)
hMenuSystem = GetSystemMenu(hwnd_winamp, 0)
hMenuWinamp = GetSubMenu(hMenuSystem, 0)
hMenuOptions = GetSubMenu(hMenuWinamp, 11)

If hwnd_winamp Then FindWinamp = 1 Else FindWinamp = 0
End Function

Public Function DeletePlayList() As Long
'Clears the play list
DeletePlayList = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_DELETE)
End Function
Public Function IsPlaying() As Long
'Returns:
'1 If playing
'3 if paused
'0 if stopped
IsPlaying = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_ISPLAYING)
End Function

Public Function GetCurrentSongPosition() As Double
'Finds the current song position in milliseconds
GetCurrentSongPosition = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_GETOUTPUTTIME)
End Function

Public Function GetSongLength() As Long
'Finds the song length in Seconds
GetSongLength = SendMessage(hwnd_winamp, WM_WA_IPC, 1, IPC_GETOUTPUTTIME)
End Function

Public Function SetCurrentSongPosition(Optional Seconds As Long, Optional Ms As Long)
'Sets the current position in the song
'Returns:
'0 if success
'1 if eof
'-1 if not playing
SetCurrentSongPosition = SendMessage(hwnd_winamp, WM_WA_IPC, (Seconds * 1000 + Ms), IPC_JUMPTOTIME)
End Function


Public Function WritePlayList() As Long
'Writes the current playlist to C:\WINAMP_DIR\Winamp.m3u
'And then finds the play position
'Now obsolete, but good for old version of winamp
'Look at GetPlayListPosition
WritePlayList = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_WRITEPLAYLIST)
End Function

Public Function SetPlayListPosition(Position As Integer) As Long
'Sets which song to play (0 being first)
SetPlayListPosition = SendMessage(hwnd_winamp, WM_WA_IPC, Position, IPC_SETPLAYLISTPOS)
End Function

Public Function SetVolume(Volume As Integer) As Long
'Sets the volume (Volume must be between 0 - 255)
SetVolume = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
End Function

Public Function SetPanning(PanPosition As Integer) As Long
'Sets the panning (PanPosition must be between 0 - 255)
SetPanning = SendMessage(hwnd_winamp, WM_WA_IPC, PanPosition, IPC_SETPANNING)
End Function

Public Function GetPlayListLength() As Long
'Gets amount of songs in play list
GetPlayListLength = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_GETLISTLENGTH)
End Function


Public Function GetPlayListPosition() As Long
'Returns which song its playing in the playlist
'0 being first
GetPlayListPosition = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_GETLISTPOS)
End Function

Public Function GetSamplerate() As Long
'Gets the samplerate
GetSamplerate = SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_GETINFO)
End Function

Public Function GetBitrate() As Long
'Gets the bitrate
GetBitrate = SendMessage(hwnd_winamp, WM_WA_IPC, 1, IPC_GETINFO)
End Function

Public Function GetChannels() As Long
'Gets the channel
GetChannels = SendMessage(hwnd_winamp, WM_WA_IPC, 2, IPC_GETINFO)
End Function

Public Function GetEQBandData(BandNumber As Integer) As Long
'Get each EQ banddata (0 being the first, 9 being last)
'Returns 0 - 255
If BandNumber > 9 Then Exit Function
GetEQBandData = SendMessage(hwnd_winamp, WM_WA_IPC, BandNumber, IPC_GETEQDATA)
End Function

Public Function GetEQPreampValue() As Long
'Gets the preamp value (Between 0 - 255)
GetEQPreampValue = SendMessage(hwnd_winamp, WM_WA_IPC, 10, IPC_GETEQDATA)
End Function

Public Function GetEQEnabled()
'1 if EQ is enabled
'0 if it isn't
GetEQEnabled = SendMessage(hwnd_winamp, WM_WA_IPC, 11, IPC_GETEQDATA)
End Function

Public Function GetEQAutoLoad()
'1 if EQ is autoloaded
'0 if it isn't
GetEQAutoLoad = SendMessage(hwnd_winamp, WM_WA_IPC, 12, IPC_GETEQDATA)
End Function

Public Function PlayFile(FileToPlay As String) As Long
'Adds FileToPlay to the play list
Dim CDS As COPYDATASTRUCT
CDS.dwData = IPC_PLAYFILE
CDS.lpData = FileToPlay
CDS.cbData = Len(FileToPlay) + 1
PlayFile = SendMessageCDS(hwnd_winamp, WM_COPYDATA, 0, CDS)
End Function

Public Function ChangeDirectory(Directory As String) As Long
'Changes directory
Dim CDS As COPYDATASTRUCT
CDS.dwData = IPC_CHDIR
CDS.lpData = Directory
CDS.cbData = Len(Directory) + 1
ChangeDirectory = SendMessageCDS(hwnd_winamp, WM_COPYDATA, 0, CDS)
End Function

Public Function ToggleEQWindow() As Long
'Turns on or off the EQ window
ToggleEQWindow = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_OPTIONS_EQ, 0)
End Function

Public Function TogglePlayListWindow() As Long
'Turns on or off play list window
TogglePlayListWindow = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_OPTIONS_PLEDIT, 0)
End Function

Public Function VolumeUp() As Long
'Raises the volume a tiny bit
VolumeUp = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEUP, 0)
End Function
Public Function VolumeDown() As Long
'Sets the volume down a tiny bit
VolumeDown = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEDOWN, 0)
End Function

Public Function Rewind() As Long
'Rewinds by 5 seconds
Rewind = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_REW5S, 0)
End Function

Public Function FastForward() As Long
'Fast forwards by 5 seconds
FastForward = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_FFWD5S, 0)
End Function

Public Function PreviousTrack() As Long
'Plays the previous song
PreviousTrack = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0)
End Function

Public Function PlaySong() As Long
'Plays the current song
PlaySong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
End Function

Public Function PauseSong() As Long
'Pauses playing
PauseSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0)
End Function
Public Function StopSong() As Long
'Stops playing
StopSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0)
End Function

Public Function NextTrack() As Long
'Plays the next song in the playlist
NextTrack = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)
End Function

Public Function FadeStop() As Long
'slowly fades away until it stops
FadeStop = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4_SHIFT, 0)
End Function

Public Function FirstSong() As Long
'Goes to the first song in the play list
FirstSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1_CTRL, 0)
End Function

Public Function LastSong() As Long
'Goes to the last song in the play list
LastSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5_CTRL, 0)
End Function
Public Function OpenLocation() As Long
'Shows Open Location Dialog
OpenLocation = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2_CTRL, 0)
End Function
Public Function LoadFile() As Long
'Shows Load a file dialog
LoadFile = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_FILE_PLAY, 0)
End Function
Public Function ShowPreferences() As Long
'Shows Preferences Dialog
ShowPreferences = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_OPTIONS_PREFS, 0)
End Function

Public Function ToggleAlwaysOnTop() As Long
'Turns Always On Top On and Off
ToggleAlwaysOnTop = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_OPTIONS_AOT, 0)
End Function

Public Function ShowAbout() As Long
'Shows About Box
ShowAbout = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_HELP_ABOUT, 0)
End Function
Public Function QuitWinamp() As Long
'Quit Winamp
QuitWinamp = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_FILE_QUIT, 0)
End Function
'gets the current song playing
Public Function GetSongTitle() As String
On Error Resume Next
Dim sSong_buffer As String * 100
'get the title
Call GetWindowText(hwnd_winamp, sSong_buffer, 99)
'edit the sSong_buffer
'xx.aaaaaa - tttttttt - Winamp
'get the track number
Dim iTrackNumber As Integer
iTrackNumber = InStr(1, sSong_buffer, ".")
TrackTitle.sTrackNumber = Trim$(Left(sSong_buffer, Val(iTrackNumber - 1)))
'get the artist
Dim iArtist As Integer
iArtist = InStr(iTrackNumber, sSong_buffer, "-")
TrackTitle.sArtist = Trim(Mid(sSong_buffer, iTrackNumber + 1, (iArtist - iTrackNumber - 1)))
Dim iSong As Integer
iSong = InStr(iArtist + 1, sSong_buffer, "-")
TrackTitle.sName = Trim(Mid(sSong_buffer, iArtist + 1, (iSong - iArtist - 1)))
'get the title
GetSongTitle = TrackTitle.sTrackNumber + ". " + TrackTitle.sArtist + " - " + TrackTitle.sName

End Function
Public Function IsShuffle() As Boolean
'check if the Shuffle button was clicked
If (GetMenuState(hMenuOptions, WINAMP_MENU_SHUFFLE, MF_BYCOMMAND)) = WU_MF_CHECKED Then
IsShuffle = True
Else
IsShuffle = False
End If
End Function

Public Function IsRepeat() As Boolean
'check if the Repeat Button was click or not
If (GetMenuState(hMenuOptions, WINAMP_MENU_REPEAT, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsRepeat = True
Else
IsRepeat = False
End If
End Function
Public Function Back10Songs() As Long
'Goes to the first song in the play list
Back10Songs = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BACK_TEN, 0)
End Function

Public Function Forward10Songs() As Long
'Goes to the last song in the play list
Forward10Songs = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_FORWARD_TEN, 0)
End Function

Public Function ShowURLWindow() As Long
'show's the url window
ShowURLWindow = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_URL_WINDOW, 0)
End Function
Public Function ToggleShuffle() As Long
'check off and on the Shuffle Button
ToggleShuffle = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_SHUFFLE, 0)
End Function
Public Function ToggleRepeat() As Long
'check off the Repeat on/off button
ToggleRepeat = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_REPEAT, 0)
End Function
Public Function ToggleMain() As Long
'trun on/off the main window
ToggleMain = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_WINDMAIN, 0)
End Function
Public Function IsTimeElapsed() As Boolean
If (GetMenuState(hMenuOptions, WINAMP_MENU_TIMEELAPSED, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsTimeElapsed = True
Else
IsTimeElapsed = False
End If
End Function


Public Function IsTimeRemaining() As Boolean
If (GetMenuState(hMenuOptions, WINAMP_MENU_TIMEREMAINING, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsTimeRemaining = True
Else
IsTimeRemaining = False
End If

End Function
Public Function IsAlwaysOnTop() As Boolean
If (GetMenuState(hMenuOptions, WINAMP_MENU_ALWAYSONTOP, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsAlwaysOnTop = True
Else
IsAlwaysOnTop = False
End If
End Function

Public Function IsDoubleSize() As Boolean
If (GetMenuState(hMenuOptions, WINAMP_MENU_DOUBLESIZE, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsDoubleSize = True
Else
IsDoubleSize = False
End If
End Function

Public Function IsEasyMove() As Boolean
If (GetMenuState(hMenuOptions, WINAMP_MENU_EASYMOVE, MF_BYCOMMAND) = WU_MF_CHECKED) Then
IsEasyMove = True
Else
IsEasyMove = False
End If
End Function
Public Function ToggleDoubleSize() As Long
ToggleDoubleSize = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_DOUBLESIZE, 0)
End Function
Public Function ToggleBrowser() As Long
ToggleBrowser = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_WINDBROWSER, 0)
End Function
Public Function ToggleShade() As Long
ToggleShade = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_SHADEMODE, 0)
End Function
Public Function ConvertTime(TimeSeconds As Long)
Dim TimeMin 'Time in minutes & decimal (5.911 minutes)
Dim TimeMinOnly 'Time in whole minutes only (5.0 minutes)
Dim TimeSecOnly 'Seconds portion of time only (54 seconds (.911 * 60))

Dim MinutesStr 'Minutes converted to a string ("05" minutes)
Dim SecondsStr 'Seconds converted to a string ("54" seconds)

TimeMin = (TimeSeconds / 60)
TimeMinOnly = Int(TimeMin)
TimeSecOnly = Int((TimeMin - TimeMinOnly) * 60)

If TimeMinOnly < 10 Then
MinutesStr = "0" & TimeMinOnly
Else
MinutesStr = TimeMinOnly
End If

If TimeSecOnly < 10 Then
SecondsStr = "0" & TimeSecOnly
Else
SecondsStr = TimeSecOnly
End If

ConvertTime = MinutesStr & ":" & SecondsStr
End Function[/code]

Requested by hismajesty.
July 19, 2004, 12:18 AM
hismajesty
eww!
July 19, 2004, 12:21 AM
hismajesty
Alright, here I wrote one for you.

[code]Public clsWinamp As new clsWinamp[/code]

[code]'---------------------------------------------------------------------------------------
' Module : clsWinamp.cls
' Date : 7/18/04
' Author : Trust[e1] (truste1@gmail.com)
' http://www.clan-e1.net Op e1- @ USWest
' Purpose : Interacts with the Winamp program.
' Notes : I only included a few basic commands, to include more add them into
' the enumeration.
'--------------------------------------------------------------------------------------

[/code]

[code]
Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Private Const WA_COMMAND As Long = &H111

Public Enum WA_COMMANDS 'You can add more if you'd like.
WA_PREVTRACK = &H9C6C
WA_NEXTTRACK = &H9C70
WA_PLAYTRACK = &H9C6D
WA_PAUSETRACK = &H9C6E
WA_STOPTRACK = &H9C6F
End Enum
[/code]

[code]
Public Function CheckWinamp() As Boolean
'Checks to see if Winamp is running.

If FindWindow("Winamp v1.x", vbNullString) Then
CheckWinamp = True
Else
CheckWinamp = False
End If

End Function
[/code]

[code]
Public Sub SendCommand(ByVal Command As WA_COMMANDS, ByVal lParam)
'Sends a message to Winamp.
'Usage Example: clsWinamp.SendCommand(WA_PAUSETRACK, &H0)

If CheckWinamp = True Then
SendMessage FindWindow("Winamp v1.x", vbNullString), WA_COMMAND, Command, lParam
End If

End Sub
[/code]

[code]
Public Function GetTitle() As String
'Gets the current title of Winamps window. (Useful for track information)
'Usage Example: Send "Current Title: " & clsWinamp.GetTitle

Dim WinampTitle As String

If CheckWinamp = True Then
WinampTitle = Space$(GetWindowTextLength(FindWindow("Winamp v1.x", vbNullString)) + 1)

Call GetWindowText(FindWindow("Winamp v1.x", vbNullString), _
WinampTitle, Len(WinampTitle))

GetTitle = WinampTitle
End If

End Function[/code]

Edit: Seperated Comments/Declares/Functions/Subs up.
July 19, 2004, 12:51 AM
LizArD
What about commands *grunts*
July 19, 2004, 12:56 AM
hismajesty
[quote author=LizArD link=board=31;threadid=7655;start=30#msg71237 date=1090198578]
What about commands *grunts*
[/quote]

Did you read my documenation on using SendCommand()?
July 19, 2004, 1:05 AM
LizArD
Erm I meant if I should keep my old commands or redo them, the old ones seem fine ey?
July 19, 2004, 1:09 AM
hismajesty
[quote author=LizArD link=board=31;threadid=7655;start=30#msg71242 date=1090199362]
Erm I meant if I should keep my old commands or redo them, the old ones seem fine ey?
[/quote]

I guess, just use

[code]
Select Case WinampCommandUserWants
Case Pause
clsWinamp.SendCommand(WA_PAUSETRACK, &H0)
Case Play
'Play Code
Case Etc
'blah
End Select
[/code]
July 19, 2004, 1:13 AM
LizArD
when I paste this in the first thing i see is [code] clsWinamp.SendCommand(WA_PAUSETRACK, &H0)[/code] in red.
July 19, 2004, 1:24 AM
hismajesty
[quote author=LizArD link=board=31;threadid=7655;start=30#msg71244 date=1090200293]
when I paste this in the first thing i see is [code] clsWinamp.SendCommand(WA_PAUSETRACK, &H0)[/code] in red.
[/quote]

Remove the parenthesis or add Call to the front of it.
July 19, 2004, 1:50 AM
LizArD
thanks for everyones help adding winamp.
July 19, 2004, 2:24 AM
LizArD
[code]Select Case WinampCommandUserWants
Case mp3
Send "Current Title: " & clsWinamp.GetTitle
End Select[/code]

^ Is that correct from the code below..?

[quote author=hismajesty[yL] link=board=31;threadid=7655;start=30#msg71234 date=1090198282]
Alright, here I wrote one for you.

[code]
Public Function GetTitle() As String
'Gets the current title of Winamps window. (Useful for track information)
'Usage Example: Send "Current Title: " & clsWinamp.GetTitle

Dim WinampTitle As String

If CheckWinamp = True Then
WinampTitle = Space$(GetWindowTextLength(FindWindow("Winamp v1.x", vbNullString)) + 1)

Call GetWindowText(FindWindow("Winamp v1.x", vbNullString), _
WinampTitle, Len(WinampTitle))

GetTitle = WinampTitle
End If

End Function[/code]
[/quote]
Sorry to touch back up on this so long after this was already discussed however I did add that to commands.

However whenever I do .mp3 it does say the track, however it also disconnects from battle.net and ipbans itself. Woot... It never says it in bnet, but on the bot screen it says it

[9:47:08 AM] <gLock> Mp3: 2. - - Winamp[9:47:08 AM] Error: Battle.net Disconnected
[9:47:08 AM] BNET: Connecting...
[9:47:08 AM] BNET: 10054 -- Connection is aborted due to timeout or other failure

What did I do wrong?
August 12, 2004, 1:57 PM
Soul Taker
Looks like you're possibly sending some character Bnet doesn't like, since the line break is screwed up. Maybe you're sending a null in that message?
August 12, 2004, 10:34 PM
LizArD
any clue where is it =D?
August 12, 2004, 10:41 PM
hismajesty
Paste your "Send" sub.
August 13, 2004, 1:52 AM
FrOzeN
heres probably the best way to set out the code..
this doesn't have set volume and stuff but you can add it in using info from the other 3 pages in this topic :P

put this is a module
[code]Public l_winamp As New Winamp 'Change if not Winamp.cls[/code]

put this a a class module (Winamp.cls)
[code]Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Const m_Const_Winamp As String = "Winamp v1.x"
Private Const m_WM_COMMAND = &H111
Public Enum Enum_WA_Command
WA_Previous_track = 40044
WA_Next_track = 40048
WA_PLAY = 40045
WA_Pause_Unpause = 40046
WA_STOP = 40047
WA_Fadeout_and_stop = 40147
WA_Stop_after_current = 40157
WA_Fast_forward_5_seconds = 40148
WA_Fast_rewind_5_seconds = 40144
WA_Start_of_playlist = 40154
WA_Go_to_end_of_playlist = 40158
WA_Open_file_dialog = 40029
WA_Open_URL_dialog = 40155
WA_Open_file_info_box = 40188
WA_Set_time_display_mode_to_elapsed = 40037
WA_Set_time_display_mode_to_remaining = 40038
WA_Toggle_preferences_screen = 40012
WA_Open_visualization_options = 40190
WA_Open_visualization_plug_in_options = 40191
WA_Execute_current_visualization_plug_in = 40192
WA_Toggle_about_box = 40041
WA_Toggle_title_Autoscrolling = 40189
WA_Toggle_always_on_top = 40019
WA_Toggle_Windowshade = 40064
WA_Toggle_Playlist_Windowshade = 40266
WA_Toggle_doublesize_mode = 40165
WA_Toggle_EQ = 40036
WA_Toggle_playlist_editor = 40040
WA_Toggle_main_window_visible = 40258
WA_Toggle_minibrowser = 40298
WA_Toggle_easymove = 40186
WA_Raise_volume_by_1 = 40058
WA_Lower_volume_by_1 = 40059
WA_Toggle_repeat = 40022
WA_Toggle_shuffle = 40023
WA_Open_jump_to_time_dialog = 40193
WA_Open_jump_to_file_dialog = 40194
WA_Open_skin_selector = 40219
WA_Configure_current_visualization_plug_in = 40221
WA_Reload_the_current_skin = 40291
WA_Close_Winamp = 40001
WA_Moves_back_10_tracks_in_playlist = 40197
WA_Show_the_edit_bookmarks = 40320
WA_Adds_current_track_as_a_bookmark = 40321
WA_Play_audio_CD = 40323
WA_Load_a_preset_from_EQ = 40253
WA_Save_a_preset_to_EQF = 40254
WA_Opens_load_presets_dialog = 40172
WA_Opens_auto_load_resets_dialog = 40173
WA_Load_default_preset = 40174
WA_Opens_save_preset_dialog = 40175
WA_Opens_auto_load_save_preset = 40176
WA_Opens_delete_preset_dialog = 40178
WA_Opens_delete_an_auto_load_preset_dialog = 40180
End Enum
Public Function IsWinampRunning() As Boolean
IsWinampRunning = IIf(FindWindow(m_Const_Winamp, vbNullString) = 0, False, True)
End Function

Public Sub Execute(ByVal l_Command As Enum_WA_Command)
SendMessage FindWindow(m_Const_Winamp, vbNullString), m_WM_COMMAND, l_Command, 0
End Sub

Public Function GetWindowTitle(ByVal WindowTitle As String) As String
Dim Title As String
TheHWnd = FindWindow(WindowTitle, vbNullString)
Title = Space$(GetWindowTextLength(TheHWnd) + 1)
Call GetWindowText(TheHWnd, Title, Len(Title))
Title = Left$(Title, Len(Title) - 1)
GetWindowTitle = Title
End Function[/code]

usage.. this would make it play..
[code]If l_winamp.IsWinampRunning Then l_winamp.Execute Enum_WA_Command.WA_PLAY[/code]
August 13, 2004, 6:05 AM
LizArD
[code]Case "mp3"
Call clsWinamp.GetTitle
Send "Mp3: "[/code]

Im guessing it should be that, at this point in time it is

[code]Send "Current Title: " & clsWinamp.GetTitle[/code]


[code]Public Function GetTitle() As String
'Gets the current title of Winamps window. (Useful for track information)
'Usage Example: Send "Current Title: " & clsWinamp.GetTitle

Dim WinampTitle As String

If CheckWinamp = True Then
WinampTitle = Space$(GetWindowTextLength(FindWindow("Winamp v1.x", vbNullString)) + 1)

Call GetWindowText(FindWindow("Winamp v1.x", vbNullString), _
WinampTitle, Len(WinampTitle))

GetTitle = WinampTitle
End If

End Function[/code]
August 13, 2004, 2:41 PM
Dyndrilliac
[code]Public Function FindWinamp() As Long
'Find winamp window
'Returns 1 if winamp is open, 0 if not
Dim hMenuSystem As Long

hwnd_winamp = FindWindow("Winamp v1.x", vbNullString)
hMenuSystem = GetSystemMenu(hwnd_winamp, 0)
hMenuWinamp = GetSubMenu(hMenuSystem, 0)
hMenuOptions = GetSubMenu(hMenuWinamp, 11)

If hwnd_winamp Then FindWinamp = 1 Else FindWinamp = 0
End Function[/code]

[code]Public Function SetVolume(Volume As Integer) As Long
'Sets the volume (Volume must be between 0 - 255)
SetVolume = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
End Function

Public Function Rewind() As Long
'Rewinds by 5 seconds
Rewind = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_REW5S, 0)
End Function

Public Function FastForward() As Long
'Fast forwards by 5 seconds
FastForward = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_FFWD5S, 0)
End Function

Public Function PreviousTrack() As Long
'Plays the previous song
PreviousTrack = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0)
End Function

Public Function PlaySong() As Long
'Plays the current song
PlaySong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
End Function

Public Function PauseSong() As Long
'Pauses playing
PauseSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0)
End Function
Public Function StopSong() As Long
'Stops playing
StopSong = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0)
End Function

Public Function NextTrack() As Long
'Plays the next song in the playlist
NextTrack = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)
End Function

Public Function FadeStop() As Long
'slowly fades away until it stops
FadeStop = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4_SHIFT, 0)
End Function

Public Function VolumeUp() As Long
'Raises the volume a tiny bit
VolumeUp = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEUP, 0)
End Function
Public Function VolumeDown() As Long
'Sets the volume down a tiny bit
VolumeDown = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEDOWN, 0)
End Function

Public Function PlayFile(FileToPlay As String) As Long
'Adds FileToPlay to the play list
Dim CDS As COPYDATASTRUCT
CDS.dwData = IPC_PLAYFILE
CDS.lpData = FileToPlay
CDS.cbData = Len(FileToPlay) + 1
PlayFile = SendMessageCDS(hwnd_winamp, WM_COPYDATA, 0, CDS)
End Function

Public Function QuitWinamp() As Long
'Quit Winamp
QuitWinamp = PostMessage(hwnd_winamp, WM_COMMAND, WINAMP_FILE_QUIT, 0)
End Function

'gets the current song playing
Public Function GetSongTitle() As String
On Error Resume Next
Dim sSong_buffer As String * 100
'get the title
Call GetWindowText(hwnd_winamp, sSong_buffer, 99)
'edit the sSong_buffer
'xx.aaaaaa - tttttttt - Winamp
'get the track number
Dim iTrackNumber As Integer
iTrackNumber = InStr(1, sSong_buffer, ".")
TrackTitle.sTrackNumber = Trim$(Left(sSong_buffer, Val(iTrackNumber - 1)))
'get the artist
Dim iArtist As Integer
iArtist = InStr(iTrackNumber, sSong_buffer, "-")
TrackTitle.sArtist = Trim(Mid(sSong_buffer, iTrackNumber + 1, (iArtist - iTrackNumber - 1)))
Dim iSong As Integer
iSong = InStr(iArtist + 1, sSong_buffer, "-")
TrackTitle.sName = Trim(Mid(sSong_buffer, iArtist + 1, (iSong - iArtist - 1)))
'get the title
GetSongTitle = TrackTitle.sTrackNumber + ". " + TrackTitle.sArtist + " - " + TrackTitle.sName
End Function[/code]

That isn't everything in my module but that should give you the general idea.
August 14, 2004, 6:47 PM
LizArD
sorry for ignoring everyone else however this question is for hismajesty, remember this?

[code]Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Private Const WA_COMMAND As Long = &H111

Public Enum WA_COMMANDS 'You can add more if you'd like.
WA_PREVTRACK = &H9C6C
WA_NEXTTRACK = &H9C70
WA_PLAYTRACK = &H9C6D
WA_PAUSETRACK = &H9C6E
WA_STOPTRACK = &H9C6F
End Enum[/code]

you said I can add more if i'd like to, where do i find the other WA_COMMANDS at?[code][/code]
August 14, 2004, 9:54 PM
hismajesty
Check NSDN
August 15, 2004, 12:37 AM
Grok
[quote author=hismajesty[yL] link=board=31;threadid=7655;start=45#msg75515 date=1092530264]
Check NSDN
[/quote]

Why would MSDN have WinAmp enumerations for commands?
August 15, 2004, 1:21 AM
St0rm.iD
[quote author=Grok link=board=31;threadid=7655;start=45#msg75524 date=1092532866]
[quote author=hismajesty[yL] link=board=31;threadid=7655;start=45#msg75515 date=1092530264]
Check NSDN
[/quote]

Why would MSDN have WinAmp enumerations for commands?
[/quote]

Because MSDN isn't the NullSoft Developers Network, silly :-P
August 15, 2004, 2:54 AM
FrOzeN
[quote author=LizArD link=board=31;threadid=7655;start=45#msg75498 date=1092520476]
you said I can add more if i'd like to, where do i find the other WA_COMMANDS at?[code][/code]
[/quote]

theres alot in my post:
[code]WA_Previous_track = 40044
WA_Next_track = 40048
WA_PLAY = 40045
WA_Pause_Unpause = 40046
WA_STOP = 40047
WA_Fadeout_and_stop = 40147
WA_Stop_after_current = 40157
WA_Fast_forward_5_seconds = 40148
WA_Fast_rewind_5_seconds = 40144
WA_Start_of_playlist = 40154
WA_Go_to_end_of_playlist = 40158
WA_Open_file_dialog = 40029
WA_Open_URL_dialog = 40155
WA_Open_file_info_box = 40188
WA_Set_time_display_mode_to_elapsed = 40037
WA_Set_time_display_mode_to_remaining = 40038
WA_Toggle_preferences_screen = 40012
WA_Open_visualization_options = 40190
WA_Open_visualization_plug_in_options = 40191
WA_Execute_current_visualization_plug_in = 40192
WA_Toggle_about_box = 40041
WA_Toggle_title_Autoscrolling = 40189
WA_Toggle_always_on_top = 40019
WA_Toggle_Windowshade = 40064
WA_Toggle_Playlist_Windowshade = 40266
WA_Toggle_doublesize_mode = 40165
WA_Toggle_EQ = 40036
WA_Toggle_playlist_editor = 40040
WA_Toggle_main_window_visible = 40258
WA_Toggle_minibrowser = 40298
WA_Toggle_easymove = 40186
WA_Raise_volume_by_1 = 40058
WA_Lower_volume_by_1 = 40059
WA_Toggle_repeat = 40022
WA_Toggle_shuffle = 40023
WA_Open_jump_to_time_dialog = 40193
WA_Open_jump_to_file_dialog = 40194
WA_Open_skin_selector = 40219
WA_Configure_current_visualization_plug_in = 40221
WA_Reload_the_current_skin = 40291
WA_Close_Winamp = 40001
WA_Moves_back_10_tracks_in_playlist = 40197
WA_Show_the_edit_bookmarks = 40320
WA_Adds_current_track_as_a_bookmark = 40321
WA_Play_audio_CD = 40323
WA_Load_a_preset_from_EQ = 40253
WA_Save_a_preset_to_EQF = 40254
WA_Opens_load_presets_dialog = 40172
WA_Opens_auto_load_resets_dialog = 40173
WA_Load_default_preset = 40174
WA_Opens_save_preset_dialog = 40175
WA_Opens_auto_load_save_preset = 40176
WA_Opens_delete_preset_dialog = 40178
WA_Opens_delete_an_auto_load_preset_dialog = 40180[/code]
August 15, 2004, 4:19 AM
Grok
[quote author=$t0rm link=board=31;threadid=7655;start=45#msg75538 date=1092538444]
[quote author=Grok link=board=31;threadid=7655;start=45#msg75524 date=1092532866]
[quote author=hismajesty[yL] link=board=31;threadid=7655;start=45#msg75515 date=1092530264]
Check NSDN
[/quote]

Why would MSDN have WinAmp enumerations for commands?
[/quote]

Because MSDN isn't the NullSoft Developers Network, silly :-P
[/quote]

Oooh very tricky.
August 15, 2004, 4:39 AM
LizArD
However yours is a tad diff different looking then mine.... what would I use for the get track title command? for my code...



[quote author=LizArD link=board=31;threadid=7655;start=45#msg75498 date=1092520476]
sorry for ignoring everyone else however this question is for hismajesty, remember this?

[code]Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Private Const WA_COMMAND As Long = &H111

Public Enum WA_COMMANDS 'You can add more if you'd like.
WA_PREVTRACK = &H9C6C
WA_NEXTTRACK = &H9C70
WA_PLAYTRACK = &H9C6D
WA_PAUSETRACK = &H9C6E
WA_STOPTRACK = &H9C6F
End Enum[/code]

you said I can add more if i'd like to, where do i find the other WA_COMMANDS at?[code][/code]
[/quote]






WA_TRACKINFO = &??????

?
August 15, 2004, 4:40 AM
LizArD
[quote author=FrOzeN link=board=31;threadid=7655;start=45#msg75330 date=1092377148]
heres probably the best way to set out the code..
this doesn't have set volume and stuff but you can add it in using info from the other 3 pages in this topic :P

put this is a module
[code]Public l_winamp As New Winamp 'Change if not Winamp.cls[/code]

put this a a class module (Winamp.cls)
[code]Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Const m_Const_Winamp As String = "Winamp v1.x"
Private Const m_WM_COMMAND = &H111
Public Enum Enum_WA_Command
WA_Previous_track = 40044
WA_Next_track = 40048
WA_PLAY = 40045
WA_Pause_Unpause = 40046
WA_STOP = 40047
WA_Fadeout_and_stop = 40147
WA_Stop_after_current = 40157
WA_Fast_forward_5_seconds = 40148
WA_Fast_rewind_5_seconds = 40144
WA_Start_of_playlist = 40154
WA_Go_to_end_of_playlist = 40158
WA_Open_file_dialog = 40029
WA_Open_URL_dialog = 40155
WA_Open_file_info_box = 40188
WA_Set_time_display_mode_to_elapsed = 40037
WA_Set_time_display_mode_to_remaining = 40038
WA_Toggle_preferences_screen = 40012
WA_Open_visualization_options = 40190
WA_Open_visualization_plug_in_options = 40191
WA_Execute_current_visualization_plug_in = 40192
WA_Toggle_about_box = 40041
WA_Toggle_title_Autoscrolling = 40189
WA_Toggle_always_on_top = 40019
WA_Toggle_Windowshade = 40064
WA_Toggle_Playlist_Windowshade = 40266
WA_Toggle_doublesize_mode = 40165
WA_Toggle_EQ = 40036
WA_Toggle_playlist_editor = 40040
WA_Toggle_main_window_visible = 40258
WA_Toggle_minibrowser = 40298
WA_Toggle_easymove = 40186
WA_Raise_volume_by_1 = 40058
WA_Lower_volume_by_1 = 40059
WA_Toggle_repeat = 40022
WA_Toggle_shuffle = 40023
WA_Open_jump_to_time_dialog = 40193
WA_Open_jump_to_file_dialog = 40194
WA_Open_skin_selector = 40219
WA_Configure_current_visualization_plug_in = 40221
WA_Reload_the_current_skin = 40291
WA_Close_Winamp = 40001
WA_Moves_back_10_tracks_in_playlist = 40197
WA_Show_the_edit_bookmarks = 40320
WA_Adds_current_track_as_a_bookmark = 40321
WA_Play_audio_CD = 40323
WA_Load_a_preset_from_EQ = 40253
WA_Save_a_preset_to_EQF = 40254
WA_Opens_load_presets_dialog = 40172
WA_Opens_auto_load_resets_dialog = 40173
WA_Load_default_preset = 40174
WA_Opens_save_preset_dialog = 40175
WA_Opens_auto_load_save_preset = 40176
WA_Opens_delete_preset_dialog = 40178
WA_Opens_delete_an_auto_load_preset_dialog = 40180
End Enum
Public Function IsWinampRunning() As Boolean
IsWinampRunning = IIf(FindWindow(m_Const_Winamp, vbNullString) = 0, False, True)
End Function

Public Sub Execute(ByVal l_Command As Enum_WA_Command)
SendMessage FindWindow(m_Const_Winamp, vbNullString), m_WM_COMMAND, l_Command, 0
End Sub

Public Function GetWindowTitle(ByVal WindowTitle As String) As String
Dim Title As String
TheHWnd = FindWindow(WindowTitle, vbNullString)
Title = Space$(GetWindowTextLength(TheHWnd) + 1)
Call GetWindowText(TheHWnd, Title, Len(Title))
Title = Left$(Title, Len(Title) - 1)
GetWindowTitle = Title
End Function[/code]

usage.. this would make it play..
[code]If l_winamp.IsWinampRunning Then l_winamp.Execute Enum_WA_Command.WA_PLAY[/code]
[/quote]


If I used this, how would I use it, aka commands

Guessing

[code]Case "stop"
Call clsWinamp.SendCommand(WA_STOP, &H111)
Send "Winamp: Play stopped."[/code]


sorry if im totally wrong, im noobsauce =[[code][/code]
August 21, 2004, 7:18 PM
Soul Taker
It looks like you would use the Execute function.
August 22, 2004, 7:44 AM
LizArD
example please
August 27, 2004, 11:44 PM
Soul Taker
The function is right there. You really should be able to figure it out, it only has one param.
August 28, 2004, 5:36 PM
St0rm.iD
WA_PLAY
August 28, 2004, 10:21 PM
Seano
know how many bots have the feature of doing: !play acdc

can anyone give me the code to play a song where the song is a variable that the user can set?
December 11, 2004, 9:21 PM
Newby
[quote author=Seano link=topic=7655.msg91950#msg91950 date=1102800099]
know how many bots have the feature of doing: !play acdc

can anyone give me the code to play a song where the song is a variable that the user can set?
[/quote]
Why don't you figure out how to code it yourself? :)
December 11, 2004, 9:25 PM
Seano
ive been trying to code it myself for a week

any help is greatly appreciated
December 11, 2004, 9:35 PM
hismajesty
You asked this at the Stealthbot forums, and it was answered.
December 12, 2004, 12:01 AM

Search