home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / X11AmpSkins / oampzip / FRONTEND.TXT < prev    next >
Text File  |  1998-03-09  |  6KB  |  181 lines

  1. This file is only useful for people who are writing frontends for Winamp.
  2. Actually, it's useful for plugin authors too.
  3.  
  4.  
  5. There are some useful notes for VB programmers at the end of this file.
  6.  
  7.  
  8.  
  9. Psuedo IPC for frontends for Winamp v1.55+ (< 2.0)
  10.  
  11. This document is horribly [de]organized, and is pretty much just hacked
  12. together for people to use.
  13.  
  14. Winamp's window is found using:
  15. hwnd_winamp = FindWindow("Winamp v1.x",NULL);
  16.  
  17. #define WM_WA_IPC WM_USER
  18. // messages are sent to the winamp window using:
  19. result = SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
  20.  
  21.  
  22. /* Messages available to send */
  23.  
  24. #define IPC_GETVERSION 0
  25. /*
  26.     IPC_GETVERSION is sent to the window, and the return value is the version
  27.         Version 1.55 = 0x1551
  28.         Version 1.6b = 0x16A0
  29.         Version 1.60 = 0x16AF
  30.         Version 1.61 = 0x16B0
  31.         Version 1.62 = 0x16B1
  32.         Version 1.64 = 0x16B3
  33.         Version 1.666 = 0x16B4
  34.         Version 1.69 = 0x16B5
  35.         Version 1.70 = 0x1700
  36.         Version 1.72 = 0x1702
  37.         Version 1.73 = 0x1703
  38.         Version 1.80 = 0x1800
  39.     the command_data parameter is 0.
  40.     so, 
  41.     if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551)
  42.         MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);
  43. */
  44.  
  45.  
  46. #define IPC_PLAYFILE 100
  47. /*
  48.     IPC_PLAYFILE is sent to the window for each char of a null terminated string of a file to ADD
  49.     to the playlist (it doesn't change the playing status). Note, if you pass a file with the extension
  50.     ".m3u" it will be treated as a playlist.
  51.     for example:
  52.         char *file = "C:\\download\\booga.mp3";
  53.         int x;
  54.         for (x = 0; x <= strlen(file); x ++)
  55.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)file[x],IPC_PLAYFILE);
  56.     will add "C:\download\booga.mp3" to the end of the playlist
  57. */
  58.  
  59. #define IPC_DELETE 101
  60. /* 
  61.     IPC_DELETE deletes the internal Winamp playlist.
  62.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
  63. */
  64.  
  65. #define IPC_STARTPLAY 102
  66. /* 
  67.     IPC_STARTPLAY starts the playing.
  68.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
  69. */
  70.  
  71. #define IPC_CHDIR 103
  72. /*
  73.     IPC_CHDIR is sent to the window for each char of a null terminated string of a directory to change to
  74.     for example:
  75.         char *dir = "C:\\Download";
  76.         int x;
  77.         for (x = 0; x <= strlen(file); x ++)
  78.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)dir[x],IPC_PLAYFILE);
  79.     will change the winamp process to "C:\download" (useful for relative pathnames and loading playlists)
  80.  
  81. */
  82. #define IPC_ISPLAYING 104
  83. /*
  84.     IPC_ISPLAYING returns the status of playback.
  85.     If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
  86.     If it returns something other than 1,3,or 0, something is screwed.
  87.     isplaying = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
  88. */
  89.  
  90.  
  91. #define IPC_GETOUTPUTTIME 105
  92. /*
  93.     IPC_GETOUTPUTTIME returns the position in milliseconds of the 
  94.           current song (lParam = 0), or the song length, in seconds (lParam = 1).
  95.     Returns -1 if not playing or error.
  96.         
  97.     song_pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
  98.     song_len = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
  99. */
  100.  
  101. #define IPC_JUMPTOTIME 106
  102. /*
  103.         *ONLY AVAILABLE IN v1.60+*
  104.     IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
  105.     Returns -1 if not playing, 1 on eof, or 0 if successful
  106.     SendMessage(hwnd_winamp,WM_WA_IPC,new_song_pos,IPC_JUMPTOTIME);
  107. */
  108. #define IPC_WRITEPLAYLIST 120
  109. /*
  110.         *ONLY AVAILABLE IN v1.666+*
  111.     IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.pl
  112.     int cursong =  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
  113.     (cursong is the index of the current song in the playlist)
  114. */
  115.  
  116.  
  117. // THESE MIGHT CHANGE in the future :)
  118. //Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
  119. // Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);
  120.  
  121. // toggles the EQ window
  122. #define WINAMP_OPTIONS_EQ               40036
  123. // toggles the playlist window
  124. #define WINAMP_OPTIONS_PLEDIT           40040
  125. // turns the volume up a little
  126. #define WINAMP_VOLUMEUP                 40058
  127. // turns the volume down a little
  128. #define WINAMP_VOLUMEDOWN               40059
  129. // fast forwards 5 seconds
  130. #define WINAMP_FFWD5S                   40060
  131. // rewinds 5 seconds
  132. #define WINAMP_REW5S                    40061
  133. // the following are the five main control buttons, with optionally shift or control pressed
  134. // (for the exact functions of each, just try it out)
  135. #define WINAMP_BUTTON1                  40044
  136. #define WINAMP_BUTTON2                  40045
  137. #define WINAMP_BUTTON3                  40046
  138. #define WINAMP_BUTTON4                  40047
  139. #define WINAMP_BUTTON5                  40048
  140. #define WINAMP_BUTTON1_SHIFT            40144
  141. #define WINAMP_BUTTON2_SHIFT            40145
  142. #define WINAMP_BUTTON3_SHIFT            40146
  143. #define WINAMP_BUTTON4_SHIFT            40147
  144. #define WINAMP_BUTTON5_SHIFT            40148
  145. #define WINAMP_BUTTON1_CTRL             40154
  146. #define WINAMP_BUTTON2_CTRL             40155
  147. #define WINAMP_BUTTON3_CTRL             40156
  148. #define WINAMP_BUTTON4_CTRL             40157
  149. #define WINAMP_BUTTON5_CTRL             40158
  150.  
  151. // always goes to the previous song (unlike button 1), 1.666+
  152. #define WINAMP_PREVSONG                    40198
  153.  
  154. // pops up the load file(s) box
  155. #define WINAMP_FILE_PLAY                40029
  156. // pops up the preferences
  157. #define WINAMP_OPTIONS_PREFS            40012
  158. // toggles always on top
  159. #define WINAMP_OPTIONS_AOT              40019
  160. // pops up the about box :)
  161. #define WINAMP_HELP_ABOUT               40041
  162.  
  163.  
  164. /* A little about Visual Basic
  165. In VB, the SendMessage function does not work, you must use the SendMessageTimeout. 
  166. Otherwise, VB will not wait for WinAmp to return a value. Here's an example...
  167.     Dim Success as Long
  168.     Dim ReturnValue As Long
  169.     Success = SendMessageTimeout(WinampHandle, WM_USER, 0, 104, SMTO_BLOCK, 1000, ReturnValue)
  170.     MsgBox (ReturnValue)
  171. If you are sending commands, use this format;
  172.     Dim Success as Long
  173.     Success = PostMessage(WinampHandle, WM_COMMAND, 40022, 0)
  174. // -VB notes by Amal G.
  175. */
  176.  
  177.  
  178.  
  179. // hope this helps, 
  180. // -Justin [justin@nullsoft.com]
  181.