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);
}
}
}