The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
frontend.h
Go to the documentation of this file.
1 #ifndef _WAFE_H_
2 #define _WAFE_H_
3 /*
4 ** Winamp frontend/plug-in control API documentation v1.1.
5 ** By Justin Frankel. Updates by Christophe Thibault.
6 ** Copyright (C) 1997-2000, Nullsoft Inc.
7 ** Last updated: JUL.12.2000.
8 **
9 ** Introduction
10 ** -----------------------
11 ** This file describes a means to easily communicate to Winamp
12 ** via the classic Win32 Message API.
13 **
14 ** These definitions/code assume C/C++. Porting to VB/Delphi shouldn't
15 ** be too hard.
16 **
17 ** First, you find the HWND of the Winamp main window. From a plug-in
18 ** you can easily extract this from the plug-in structure (hMainWindow,
19 ** hwndParent, whatever). For external apps, use:
20 **
21 ** HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL);
22 **
23 ** (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility)
24 **
25 ** Once you have the hwnd_winamp, it's a good idea to check the version
26 ** number. To do this, you send a WM_WA_IPC message to hwnd_winamp.
27 ** Note that WM_WA_IPC is defined as Win32's WM_USER.
28 **
29 ** Note that sometimes you might want to use PostMessage instead of
30 ** SendMessage.
31 */
32 
33 #define WM_WA_IPC WM_USER
34 
35 /**************************************************************************/
36 
37 #define IPC_GETVERSION 0
38 
39 /*
40 ** int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
41 **
42 ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
43 ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
44 **
45 ** The basic format for sending messages to Winamp is:
46 ** int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
47 ** (for the version check, command_data is 0).
48 */
49 
50 
51 #define IPC_DELETE 101
52 
53 /*
54 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
55 **
56 ** You can use IPC_DELETE to clear Winamp's internal playlist.
57 */
58 
59 
60 #define IPC_STARTPLAY 102
61 
62 /*
63 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
64 **
65 ** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly.
66 */
67 
68 
69 #define IPC_ISPLAYING 104
70 
71 /*
72 ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
73 **
74 ** IPC_ISPLAYING returns the status of playback.
75 ** If it returns 1, it is playing. if it returns 3, it is paused,
76 ** if it returns 0, it is not playing.
77 */
78 
79 
80 #define IPC_GETOUTPUTTIME 105
81 
82 /*
83 ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
84 **
85 ** IPC_GETOUTPUTTIME returns the position in milliseconds of the
86 ** current song (mode = 0), or the song length, in seconds (mode = 1).
87 ** Returns -1 if not playing or error.
88 */
89 
90 
91 #define IPC_JUMPTOTIME 106
92 
93 /* (requires Winamp 1.60+)
94 ** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
95 ** IPC_JUMPTOTIME sets the position in milliseconds of the
96 ** current song (approximately).
97 ** Returns -1 if not playing, 1 on eof, or 0 if successful
98 */
99 
100 
101 #define IPC_WRITEPLAYLIST 120
102 
103 /* (requires Winamp 1.666+)
104 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
105 **
106 ** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
107 ** and returns the current playlist position.
108 ** Kinda obsoleted by some of the 2.x new stuff, but still good for when
109 ** using a front-end (instead of a plug-in)
110 */
111 
112 
113 #define IPC_SETPLAYLISTPOS 121
114 
115 /* (requires Winamp 2.0+)
116 ** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
117 **
118 ** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'.
119 */
120 
121 
122 #define IPC_SETVOLUME 122
123 
124 /* (requires Winamp 2.0+)
125 ** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
126 **
127 ** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
128 */
129 
130 
131 #define IPC_SETPANNING 123
132 
133 /* (requires Winamp 2.0+)
134 ** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
135 **
136 ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
137 */
138 
139 
140 #define IPC_GETLISTLENGTH 124
141 
142 /* (requires Winamp 2.0+)
143 ** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
144 **
145 ** IPC_GETLISTLENGTH returns the length of the current playlist, in
146 ** tracks.
147 */
148 
149 
150 #define IPC_SETSKIN 200
151 
152 /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
153 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
154 **
155 ** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
156 ** can be the name of a skin, a skin .zip file, with or without path.
157 ** If path isn't specified, the default search path is the winamp skins
158 ** directory.
159 */
160 
161 
162 #define IPC_GETSKIN 201
163 
164 /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
165 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
166 **
167 ** IPC_GETSKIN puts the directory where skin bitmaps can be found
168 ** into skinname_buffer.
169 ** skinname_buffer must be MAX_PATH characters in length.
170 ** When using a .zip'd skin file, it'll return a temporary directory
171 ** where the ZIP was decompressed.
172 */
173 
174 
175 #define IPC_EXECPLUG 202
176 
177 /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
178 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
179 **
180 ** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
181 ** the format of this string can be:
182 ** "vis_whatever.dll"
183 ** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
184 ** "C:\\dir\\vis_whatever.dll,1"
185 */
186 
187 
188 #define IPC_GETPLAYLISTFILE 211
189 
190 /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
191 ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
192 **
193 ** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
194 ** returns a pointer to it. returns NULL on error.
195 */
196 
197 
198 #define IPC_GETPLAYLISTTITLE 212
199 
200 /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
201 ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
202 **
203 ** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
204 ** returns a pointer to it. returns NULL on error.
205 */
206 
207 
208 #define IPC_GETLISTPOS 125
209 
210 /* (requires Winamp 2.05+)
211 ** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
212 **
213 ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
214 ** only faster since it doesn't have to write out the list. Heh, silly me.
215 */
216 
217 
218 #define IPC_GETINFO 126
219 
220 /* (requires Winamp 2.05+)
221 ** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
222 **
223 ** IPC_GETINFO returns info about the current playing song. The value
224 ** it returns depends on the value of 'mode'.
225 ** Mode Meaning
226 ** ------------------
227 ** 0 Samplerate (i.e. 44100)
228 ** 1 Bitrate (i.e. 128)
229 ** 2 Channels (i.e. 2)
230 */
231 
232 
233 #define IPC_GETEQDATA 127
234 
235 /* (requires Winamp 2.05+)
236 ** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
237 **
238 ** IPC_GETEQDATA queries the status of the EQ.
239 ** The value returned depends on what 'pos' is set to:
240 ** Value Meaning
241 ** ------------------
242 ** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db)
243 ** 10 The preamp value. 0-63 (+20db - -20db)
244 ** 11 Enabled. zero if disabled, nonzero if enabled.
245 ** 12 Autoload. zero if disabled, nonzero if enabled.
246 */
247 
248 
249 #define IPC_SETEQDATA 128
250 /* (requires Winamp 2.05+)
251 ** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
252 ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
253 **
254 ** IPC_SETEQDATA sets the value of the last position retrieved
255 ** by IPC_GETEQDATA.
256 */
257 
258 #define IPC_ADDBOOKMARK 129
259 /* (requires Winamp 2.4+)
260 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_ADDBOOKMARK);
261 **
262 ** IPC_ADDBOOKMARK will add the specified file to the Winamp bookmark list.
263 */
264 
265 #define IPC_RESTARTWINAMP 135
266 /* (requires Winamp 2.2+)
267 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
268 **
269 ** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
270 */
271 
272 #define IPC_MBOPEN 241
273 /* (requires Winamp 2.05+)
274 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
275 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
276 **
277 ** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.
278 */
279 
280 #define IPC_INETAVAILABLE 242
281 /* (requires Winamp 2.05+)
282 ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
283 **
284 ** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp.
285 */
286 
287 #define IPC_UPDTITLE 243
288 /* (requires Winamp 2.2+)
289 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
290 **
291 ** IPC_UPDTITLE will ask Winamp to update the informations about the current title.
292 */
293 
294 #define IPC_CHANGECURRENTFILE 245
295 /* (requires Winamp 2.05+)
296 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
297 **
298 ** IPC_CHANGECURRENTFILE will set the current playlist item.
299 */
300 
301 #define IPC_GETMBURL 246
302 /* (requires Winamp 2.2+)
303 ** char buffer[4096]; // Urls can be VERY long
304 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
305 **
306 ** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
307 */
308 
309 #define IPC_REFRESHPLCACHE 247
310 /* (requires Winamp 2.2+)
311 ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
312 **
313 ** IPC_REFRESHPLCACHE will flush the playlist cache buffer.
314 */
315 
316 #define IPC_MBBLOCK 248
317 /* (requires Winamp 2.4+)
318 ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
319 **
320 ** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
321 */
322 
323 #define IPC_MBOPENREAL 249
324 /* (requires Winamp 2.4+)
325 ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
326 **
327 ** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if
328 ** IPC_MBBLOCK has been set to 1
329 */
330 
331 #define IPC_GET_SHUFFLE 250
332 /* (requires Winamp 2.4+)
333 ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
334 **
335 ** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
336 */
337 
338 #define IPC_GET_REPEAT 251
339 /* (requires Winamp 2.4+)
340 ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
341 **
342 ** IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
343 */
344 
345 #define IPC_SET_SHUFFLE 252
346 /* (requires Winamp 2.4+)
347 ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
348 **
349 ** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
350 */
351 
352 #define IPC_SET_REPEAT 253
353 /* (requires Winamp 2.4+)
354 ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
355 **
356 ** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)
357 */
358 
359 /**************************************************************************/
360 
361 /*
362 ** Some API calls tend to require that you send data via WM_COPYDATA
363 ** instead of WM_USER. Such as IPC_PLAYFILE:
364 */
365 
366 #define IPC_PLAYFILE 100
367 
368 /*
369 ** COPYDATASTRUCT cds;
370 ** cds.dwData = IPC_PLAYFILE;
371 ** cds.lpData = (void *) "file.mp3";
372 ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
373 ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
374 **
375 ** This will play the file "file.mp3".
376 **
377 */
378 
379 
380 #define IPC_CHDIR 103
381 
382 /*
383 ** COPYDATASTRUCT cds;
384 ** cds.dwData = IPC_CHDIR;
385 ** cds.lpData = (void *) "c:\\download";
386 ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
387 ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
388 **
389 ** This will make Winamp change to the directory C:\\download
390 **
391 */
392 
393 
394 /**************************************************************************/
395 
396 /*
397 ** Finally there are some WM_COMMAND messages that you can use to send
398 ** Winamp misc commands.
399 **
400 ** To send these, use:
401 **
402 ** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
403 */
404 
405 #define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window
406 #define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window
407 #define WINAMP_VOLUMEUP 40058 // turns the volume up a little
408 #define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little
409 #define WINAMP_FFWD5S 40060 // fast forwards 5 seconds
410 #define WINAMP_REW5S 40061 // rewinds 5 seconds
411 
412 // the following are the five main control buttons, with optionally shift
413 // or control pressed
414 // (for the exact functions of each, just try it out)
415 #define WINAMP_BUTTON1 40044
416 #define WINAMP_BUTTON2 40045
417 #define WINAMP_BUTTON3 40046
418 #define WINAMP_BUTTON4 40047
419 #define WINAMP_BUTTON5 40048
420 #define WINAMP_BUTTON1_SHIFT 40144
421 #define WINAMP_BUTTON2_SHIFT 40145
422 #define WINAMP_BUTTON3_SHIFT 40146
423 #define WINAMP_BUTTON4_SHIFT 40147
424 #define WINAMP_BUTTON5_SHIFT 40148
425 #define WINAMP_BUTTON1_CTRL 40154
426 #define WINAMP_BUTTON2_CTRL 40155
427 #define WINAMP_BUTTON3_CTRL 40156
428 #define WINAMP_BUTTON4_CTRL 40157
429 #define WINAMP_BUTTON5_CTRL 40158
430 
431 #define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box
432 #define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences
433 #define WINAMP_OPTIONS_AOT 40019 // toggles always on top
434 #define WINAMP_HELP_ABOUT 40041 // pops up the about box :)
435 
436 
437 /*
438 ** EOF.. Enjoy.
439 */
440 
441 #endif