//PlayBackDlg.h
 
 
CStringArray m_ArrayFiles;
 
HANDLEm_hThreadMoveFiles;//异步移动文件句柄
 
unsigned int ThreadID;
 
void OnRefresh();
 
void OnMoveTo();            //这个同步移动文件
 
void OnMoveToAsync();        //使用线程, 异步
 
//PlayBackDlg.cpp
 //m_listVideo是文件列表框(CListCtrl)
 unsigned int _stdcall RunMoveFilesThread( LPVOID lpParam )
 {
 CStringArray* pArryFiles = NULL;
 pArryFiles = (CStringArray*)lpParam;
 if(pArryFiles == NULL || pArryFiles->IsEmpty()) 
 {
 return 0;
 }
 CWaitCursorwait;
 //
 CString ItemText;
 CString nFileText;
 CString NewItemText;
 int n = pArryFiles->GetCount();
 CString strPath = pArryFiles->GetAt(n-1);
 for (int i =0; i < n-1; i++)
 {
 ItemText  = pArryFiles->GetAt(i);    //old file full path
 int pos = ItemText.ReverseFind('\\');
 nFileText = ItemText.Mid(pos+1);//filename
 NewItemText.Format(_T("%s%s"), strPath, nFileText); //new file full path
 MoveFile(ItemText, NewItemText);
 //DeleteFile(arrayFiles[i]);
 }
 return 0;
 }
 //
 // 同步移动文件
 void CPlayBackDlg::OnMoveTo()
 {
 //collect of selected video files
 POSITION pos = m_listVideo.GetFirstSelectedItemPosition ();
 if (!pos)
 return;//所以空的视频没有让它弹出来
 m_ArrayFiles.RemoveAll();
 int nItem = 0;
 while (pos)
 {
 nItem = m_listVideo.GetNextSelectedItem (pos);
 m_ArrayFiles.Add (m_listVideo.GetFullPath(nItem));
 }
 CPathDialog  dlg( TEXT("Folder Selection"), 
 TEXT("Select Image Directory to Browse"), NULL, this);
 // show path dialog
 if ( dlg.DoModal() == IDOK )
 {
 CString strPath = dlg.GetPathName();
 if (strPath != m_DIR)
 {
 CString ItemText;
 CString nFileText;
 CString NewItemText;
 AddBackSlash(strPath);
 //
 //start move file
 m_listVideo.SetRedraw(FALSE);//avoid flash
 CWaitCursorwait;
 int n = m_ArrayFiles.GetCount();
 for (int i =0; i<n; i++)
 {
 ItemText  = m_ArrayFiles[i];    //old file full path
 int pos = ItemText.ReverseFind('\\');
 nFileText = ItemText.Mid(pos+1);//filename
 NewItemText.Format(_T("%s%s"), strPath, nFileText); //new file full path
 MoveFile(ItemText, NewItemText);
 //DeleteFile(arrayFiles[i]);
 }
 OnRefresh();
 m_listVideo.Arrange(LVA_ALIGNTOP);
 m_listVideo.SetRedraw(TRUE);
 }
 }
 }
 //
 // 异步移动文件
 void CPlayBackDlg::OnMoveToAsync()
 {
 //collect of selected video files
 POSITION pos = m_listVideo.GetFirstSelectedItemPosition ();
 if (!pos)
 return;//所以空的视频没有让它弹出来
 m_ArrayFiles.RemoveAll();
 int nItem = 0;
 while (pos)
 {
 nItem = m_listVideo.GetNextSelectedItem (pos);
 m_ArrayFiles.Add (m_listVideo.GetFullPath(nItem));
 }
 CPathDialog  dlg( TEXT("Folder Selection"), 
 TEXT("Select Image Directory to Browse"), NULL, this); //选择目的文件夹
 // show path dialog
 if ( dlg.DoModal() == IDOK )
 {
 CString strPath = dlg.GetPathName();
 if (strPath != m_DIR)
 {
 AddBackSlash(strPath);
 m_ArrayFiles.Add(strPath);//最后一个item为要传递目的文件夹
 //
 //start move file
 m_hThreadMoveFiles = (HANDLE)_beginthreadex(NULL, 
 0,
 RunMoveFilesThread,
 (LPVOID)&m_ArrayFiles,    //传递参数
 0,
 &ThreadID);
 CloseHandle(m_hThreadMoveFiles);
 }
 }
 }
 附录: 里面用到的一个函数
/
 /
//private
 void CPlayBackDlg::AddBackSlash(CString &strPath)
 {
 int nLength = strPath.GetLength();
 if (strPath.GetAt (nLength - 1) != '\\')
 strPath += TEXT ("\\");
 }