FRONTEND.H 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. ** SendMessageW.
  31. */
  32. #define WM_WA_IPC WM_USER
  33. /**************************************************************************/
  34. #define IPC_GETVERSION 0
  35. /*
  36. ** int version = SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
  37. **
  38. ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
  39. ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
  40. **
  41. ** The basic format for sending messages to Winamp is:
  42. ** int result=SendMessageW(hwnd_winamp,WM_WA_IPC,command_data,command);
  43. ** (for the version check, command_data is 0).
  44. */
  45. #define IPC_DELETE 101
  46. /*
  47. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
  48. **
  49. ** You can use IPC_DELETE to clear Winamp's internal playlist.
  50. */
  51. #define IPC_STARTPLAY 102
  52. /*
  53. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
  54. **
  55. ** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly.
  56. */
  57. #define IPC_ISPLAYING 104
  58. /*
  59. ** int res = SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
  60. **
  61. ** IPC_ISPLAYING returns the status of playback.
  62. ** If it returns 1, it is playing. if it returns 3, it is paused,
  63. ** if it returns 0, it is not playing.
  64. */
  65. #define IPC_GETOUTPUTTIME 105
  66. /*
  67. ** int res = SendMessageW(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
  68. **
  69. ** IPC_GETOUTPUTTIME returns the position in milliseconds of the
  70. ** current song (mode = 0), or the song length, in seconds (mode = 1).
  71. ** Returns -1 if not playing or error.
  72. */
  73. #define IPC_JUMPTOTIME 106
  74. /* (requires Winamp 1.60+)
  75. ** SendMessageW(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
  76. ** IPC_JUMPTOTIME sets the position in milliseconds of the
  77. ** current song (approximately).
  78. ** Returns -1 if not playing, 1 on eof, or 0 if successful
  79. */
  80. #define IPC_WRITEPLAYLIST 120
  81. /* (requires Winamp 1.666+)
  82. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
  83. **
  84. ** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
  85. ** and returns the current playlist position.
  86. ** Kinda obsoleted by some of the 2.x new stuff, but still good for when
  87. ** using a front-end (instead of a plug-in)
  88. */
  89. #define IPC_SETPLAYLISTPOS 121
  90. /* (requires Winamp 2.0+)
  91. ** SendMessageW(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
  92. **
  93. ** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'.
  94. */
  95. #define IPC_SETVOLUME 122
  96. /* (requires Winamp 2.0+)
  97. ** SendMessageW(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
  98. **
  99. ** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
  100. */
  101. #define IPC_SETPANNING 123
  102. /* (requires Winamp 2.0+)
  103. ** SendMessageW(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
  104. **
  105. ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
  106. */
  107. #define IPC_GETLISTLENGTH 124
  108. /* (requires Winamp 2.0+)
  109. ** int length = SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
  110. **
  111. ** IPC_GETLISTLENGTH returns the length of the current playlist, in
  112. ** tracks.
  113. */
  114. #define IPC_SETSKIN 200
  115. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  116. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
  117. **
  118. ** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
  119. ** can be the name of a skin, a skin .zip file, with or without path.
  120. ** If path isn't specified, the default search path is the winamp skins
  121. ** directory.
  122. */
  123. #define IPC_GETSKIN 201
  124. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  125. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
  126. **
  127. ** IPC_GETSKIN puts the directory where skin bitmaps can be found
  128. ** into skinname_buffer.
  129. ** skinname_buffer must be MAX_PATH characters in length.
  130. ** When using a .zip'd skin file, it'll return a temporary directory
  131. ** where the ZIP was decompressed.
  132. */
  133. #define IPC_EXECPLUG 202
  134. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  135. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
  136. **
  137. ** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
  138. ** the format of this string can be:
  139. ** "vis_whatever.dll"
  140. ** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
  141. ** "C:\\dir\\vis_whatever.dll,1"
  142. */
  143. #define IPC_GETPLAYLISTFILE 211
  144. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  145. ** char *name=SendMessageW(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
  146. **
  147. ** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
  148. ** returns a pointer to it. returns NULL on error.
  149. */
  150. #define IPC_GETPLAYLISTTITLE 212
  151. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  152. ** char *name=SendMessageW(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
  153. **
  154. ** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
  155. ** returns a pointer to it. returns NULL on error.
  156. */
  157. #define IPC_GETLISTPOS 125
  158. /* (requires Winamp 2.05+)
  159. ** int pos=SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
  160. **
  161. ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
  162. ** only faster since it doesn't have to write out the list. Heh, silly me.
  163. */
  164. #define IPC_GETINFO 126
  165. /* (requires Winamp 2.05+)
  166. ** int inf=SendMessageW(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
  167. **
  168. ** IPC_GETINFO returns info about the current playing song. The value
  169. ** it returns depends on the value of 'mode'.
  170. ** Mode Meaning
  171. ** ------------------
  172. ** 0 Samplerate (i.e. 44100)
  173. ** 1 Bitrate (i.e. 128)
  174. ** 2 Channels (i.e. 2)
  175. */
  176. #define IPC_GETEQDATA 127
  177. /* (requires Winamp 2.05+)
  178. ** int data=SendMessageW(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
  179. **
  180. ** IPC_GETEQDATA queries the status of the EQ.
  181. ** The value returned depends on what 'pos' is set to:
  182. ** Value Meaning
  183. ** ------------------
  184. ** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db)
  185. ** 10 The preamp value. 0-63 (+20db - -20db)
  186. ** 11 Enabled. zero if disabled, nonzero if enabled.
  187. ** 12 Autoload. zero if disabled, nonzero if enabled.
  188. */
  189. #define IPC_SETEQDATA 128
  190. /* (requires Winamp 2.05+)
  191. ** SendMessageW(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
  192. ** SendMessageW(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
  193. **
  194. ** IPC_SETEQDATA sets the value of the last position retrieved
  195. ** by IPC_GETEQDATA.
  196. */
  197. #define IPC_ADDBOOKMARK 129
  198. /* (requires Winamp 2.4+)
  199. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_ADDBOOKMARK);
  200. **
  201. ** IPC_ADDBOOKMARK will add the specified file to the Winamp bookmark list.
  202. */
  203. #define IPC_RESTARTWINAMP 135
  204. /* (requires Winamp 2.2+)
  205. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
  206. **
  207. ** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
  208. */
  209. #define IPC_MBOPEN 241
  210. /* (requires Winamp 2.05+)
  211. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
  212. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
  213. **
  214. ** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.
  215. */
  216. #define IPC_INETAVAILABLE 242
  217. /* (requires Winamp 2.05+)
  218. ** val=SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
  219. **
  220. ** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp.
  221. */
  222. #define IPC_UPDTITLE 243
  223. /* (requires Winamp 2.2+)
  224. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
  225. **
  226. ** IPC_UPDTITLE will ask Winamp to update the informations about the current title.
  227. */
  228. #define IPC_CHANGECURRENTFILE 245
  229. /* (requires Winamp 2.05+)
  230. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
  231. **
  232. ** IPC_CHANGECURRENTFILE will set the current playlist item.
  233. */
  234. #define IPC_GETMBURL 246
  235. /* (requires Winamp 2.2+)
  236. ** char buffer[4096]; // Urls can be VERY long
  237. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
  238. **
  239. ** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
  240. */
  241. #define IPC_REFRESHPLCACHE 247
  242. /* (requires Winamp 2.2+)
  243. ** SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
  244. **
  245. ** IPC_REFRESHPLCACHE will flush the playlist cache buffer.
  246. */
  247. #define IPC_MBBLOCK 248
  248. /* (requires Winamp 2.4+)
  249. ** SendMessageW(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
  250. **
  251. ** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
  252. */
  253. #define IPC_MBOPENREAL 249
  254. /* (requires Winamp 2.4+)
  255. ** SendMessageW(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
  256. **
  257. ** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if
  258. ** IPC_MBBLOCK has been set to 1
  259. */
  260. #define IPC_GET_SHUFFLE 250
  261. /* (requires Winamp 2.4+)
  262. ** val=SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
  263. **
  264. ** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
  265. */
  266. #define IPC_GET_REPEAT 251
  267. /* (requires Winamp 2.4+)
  268. ** val=SendMessageW(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
  269. **
  270. ** IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
  271. */
  272. #define IPC_SET_SHUFFLE 252
  273. /* (requires Winamp 2.4+)
  274. ** SendMessageW(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
  275. **
  276. ** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
  277. */
  278. #define IPC_SET_REPEAT 253
  279. /* (requires Winamp 2.4+)
  280. ** SendMessageW(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
  281. **
  282. ** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)
  283. */
  284. /**************************************************************************/
  285. /*
  286. ** Some API calls tend to require that you send data via WM_COPYDATA
  287. ** instead of WM_USER. Such as IPC_PLAYFILE:
  288. */
  289. #define IPC_PLAYFILE 100
  290. /*
  291. ** COPYDATASTRUCT cds;
  292. ** cds.dwData = IPC_PLAYFILE;
  293. ** cds.lpData = (void *) "file.mp3";
  294. ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
  295. ** SendMessageW(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
  296. **
  297. ** This will play the file "file.mp3".
  298. **
  299. */
  300. #define IPC_CHDIR 103
  301. /*
  302. ** COPYDATASTRUCT cds;
  303. ** cds.dwData = IPC_CHDIR;
  304. ** cds.lpData = (void *) "c:\\download";
  305. ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
  306. ** SendMessageW(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
  307. **
  308. ** This will make Winamp change to the directory C:\\download
  309. **
  310. */
  311. /**************************************************************************/
  312. /*
  313. ** Finally there are some WM_COMMAND messages that you can use to send
  314. ** Winamp misc commands.
  315. **
  316. ** To send these, use:
  317. **
  318. ** SendMessageW(hwnd_winamp, WM_COMMAND,command_name,0);
  319. */
  320. #define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window
  321. #define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window
  322. #define WINAMP_VOLUMEUP 40058 // turns the volume up a little
  323. #define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little
  324. #define WINAMP_FFWD5S 40060 // fast forwards 5 seconds
  325. #define WINAMP_REW5S 40061 // rewinds 5 seconds
  326. // the following are the five main control buttons, with optionally shift
  327. // or control pressed
  328. // (for the exact functions of each, just try it out)
  329. #define WINAMP_BUTTON1 40044
  330. #define WINAMP_BUTTON2 40045
  331. #define WINAMP_BUTTON3 40046
  332. #define WINAMP_BUTTON4 40047
  333. #define WINAMP_BUTTON5 40048
  334. #define WINAMP_BUTTON1_SHIFT 40144
  335. #define WINAMP_BUTTON2_SHIFT 40145
  336. #define WINAMP_BUTTON3_SHIFT 40146
  337. #define WINAMP_BUTTON4_SHIFT 40147
  338. #define WINAMP_BUTTON5_SHIFT 40148
  339. #define WINAMP_BUTTON1_CTRL 40154
  340. #define WINAMP_BUTTON2_CTRL 40155
  341. #define WINAMP_BUTTON3_CTRL 40156
  342. #define WINAMP_BUTTON4_CTRL 40157
  343. #define WINAMP_BUTTON5_CTRL 40158
  344. #define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box
  345. #define WINAMP_FILE_DIR 40187 // pops up the load directory box
  346. #define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences
  347. #define WINAMP_OPTIONS_AOT 40019 // toggles always on top
  348. #define WINAMP_HELP_ABOUT 40041 // pops up the about box :)
  349. #define ID_MAIN_PLAY_AUDIOCD1 40323 // starts playing the audio CD in the first CD reader
  350. #define ID_MAIN_PLAY_AUDIOCD2 40323 // plays the 2nd
  351. #define ID_MAIN_PLAY_AUDIOCD3 40323 // plays the 3nd
  352. #define ID_MAIN_PLAY_AUDIOCD4 40323 // plays the 4nd
  353. // IDs 42000 to 45000 are reserved for gen_ff
  354. // IDs from 45000 to 57000 are reserved for library
  355. /*
  356. ** EOF.. Enjoy.
  357. */
  358. #endif