View Single Post
Old 24th January 2006, 21:20   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
Information for plugin developers:

Due to a number of the changes made from 5.12, the 'quick' hack to get the selected playlist items as devised by shaneh will no longer work with 5.2 and newer versions. As a result there is a fair chance that newer plugins will not work correctly or functionality will be severely impacted by this change (that's unfortunately what you get for using such hacky methods). {*}

On a plus side, there is now a api introduced to remove the need for such a hack to get the selected playlist entries (see below). The fix is pretty simple to implement as long as a version check is implemented for waversion>=0x5020 otherwise you'll receive 1 in all cases since it's completely unimplemented and that's the default return value for an unhandled SendMessage(..).

code:
#define IPC_PLAYLIST_GET_NEXT_SELECTED 3029
/* (requires 5.2+)
** int pl_item = SendMessage(hwnd_winamp,WM_WA_IPC,start,IPC_PLAYLIST_GET_NEXT_SELECTED);
**
** This works just like the ListView_GetNextItem(..) macro for ListView controls.
** 'start' is the index of the playlist item that you want to begin the search after or
** set this as -1 for the search to begin with the first item of the current playlist.
**
** This will return the index of the selected playlist according to the 'start' value or
** it will return -1 if there is no selection or no more selected items according to 'start'.
**
** Quick example:
**
** int sel = -1;
** // keep incrementing the start of the search so as to get all of the selected playlist entries
** while((sel = SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_PLAYLIST_GET_NEXT_SELECTED))!=-1){
** // show the playlist file entry of the selected item(s) if there were any
** MessageBox(hwnd_winamp,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_GETPLAYLISTFILE),0,0);
** }
*/

As a general note, an updated sdk for 5.2 will be released (hopefully) around the time of 5.2 going final. (soz for the frame breakage but that's api code for you, heh)

-daz

{*} JTFE Dev build 12 is affected by this issue (the one time i shift over to the faster method, heh) but a fixed build 13 will be out with in the next day or so
DrO is offline