Old 23rd May 2011, 15:21   #1
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
IPC_SETPLAYLISTPOS with IPC_CHANGECURRENTFILE

I'm trying to move my playlist files path to another location and update the list with the new paths:
code:

p = (HWND)SendMessage(w, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND);
total = SendMessage(p,WM_WA_IPC,IPC_PE_GETINDEXTOTAL,0);

for ( ;index < total; index++)
{
sfos.pFrom = (TCHAR*)SendMessage(w,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
if (SHFileOperation(&sfos))
{
TCHAR new_path[MAX_PATH];
TCHAR path[128];
SendMessage(w,WM_WA_IPC,index,IPC_SETPLAYLISTPOS);
StripPath (sfos.pFrom, path);
wsprintf(new_path,"%s\\%s", sfos.pTo, path);
SendMessage(w,WM_WA_IPC,(WPARAM)new_path,IPC_CHANGECURRENTFILE);
}
}


the operation copy/move is done correctly, but seems that the playlist entry doesn't reflect the new path item, any helps?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 23rd May 2011, 16:37   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Ok, I change my code to keep it "cleaner", now Winamp crash
code:

int do_op (HWND parent, int op, const TCHAR *src, const TCHAR *dist)
{
SHFILEOPSTRUCT sfos = {0};
sfos.hwnd = parent;
sfos.fFlags = FOF_NOCONFIRMATION|FOF_SILENT|FOF_NOERRORUI;
sfos.wFunc = op == COPY ? FO_COPY : FO_MOVE;
sfos.pTo = dist;
sfos.pFrom = src;
return SHFileOperation(&sfos);
}

void do_it (HWND w, HWND d, int op)
{

TCHAR dir[MAX_PATH];
int index;
int total;
HWND p;

GetDlgItemText (d, IDC_EDIT1, dir, sizeof(dir)+1);
index = 0;
p = (HWND)SendMessage(w, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND);
total = SendMessage(p,WM_WA_IPC,IPC_PE_GETINDEXTOTAL,0);

for ( ;index < total; index++)
{
TCHAR *src_file = (TCHAR*)SendMessage(w,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
TCHAR dist_file[MAX_PATH];
TCHAR path[128];
StripPath (src_file, path);
wsprintf(dist_file,"%s\\%s", dir, path);
if (!do_op (w, op, src_file, dist_file))
{
SendMessage(w,WM_WA_IPC,index,IPC_SETPLAYLISTPOS);
SendMessage(w,WM_WA_IPC,(WPARAM)dist_file,IPC_CHANGECURRENTFILE);
}
}
}



* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 23rd May 2011, 23:56   #3
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
ok, my error was in my StripPath function, now works as expected


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 24th May 2011, 07:31   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
heh, didn't i ask if it was stripping and forming the path correctly in irc

-daz
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump