void CopyFiles(const CString &strSrcPath, const CString &strDstPath)
{
SHFILEOPSTRUCT fops;
TCHAR source[MAX_PATH] = { 0 };
_tcscpy(source, strSrcPath); // 源文件夹
TCHAR dest[MAX_PATH] = { 0 };
_tcscpy(dest, strDstPath); // 目标文件夹
fops.hwnd = ::GetActiveWindow();
fops.wFunc = FO_COPY;
fops.pFrom = source;
fops.pTo = dest;
fops.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR || FOF_SILENT;
fops.hNameMappings = NULL;
fops.lpszProgressTitle = NULL;
int result = ::SHFileOperation(&fops);
}
注意文件路径中不能带有“\\”、“\\\”等连续的多个反斜杠,那样是读取不出来的