mfc CopyFile() 复制文件的问题
下面的代码编译没有问题,运行的时候没有复制文件,怎么回事??CStringstrpath;LPMALLOCpMalloc;if(::SHGetMalloc(&pMallo...
下面的代码编译没有问题,运行的时候没有复制文件,怎么回事??
CString strpath;
LPMALLOC pMalloc;
if(::SHGetMalloc(&pMalloc) == NOERROR)
{
BROWSEINFO bi;
char pszBuffer[MAX_PATH];
LPITEMIDLIST pidl;
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("请选择保持位置:");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if (::SHGetPathFromIDList(pidl, pszBuffer))
{
strpath= pszBuffer;
}
pMalloc->Free(pidl);
}
pMalloc->Release();
}
CString temp_file_str=" E:\\templete\\templete.xls";
CString des_file_str= strpath+"\\"+ myDialog->m_asm_name+".xls";
CopyFile(_T(temp_file_str), _T(des_file_str),false); 展开
CString strpath;
LPMALLOC pMalloc;
if(::SHGetMalloc(&pMalloc) == NOERROR)
{
BROWSEINFO bi;
char pszBuffer[MAX_PATH];
LPITEMIDLIST pidl;
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("请选择保持位置:");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if (::SHGetPathFromIDList(pidl, pszBuffer))
{
strpath= pszBuffer;
}
pMalloc->Free(pidl);
}
pMalloc->Release();
}
CString temp_file_str=" E:\\templete\\templete.xls";
CString des_file_str= strpath+"\\"+ myDialog->m_asm_name+".xls";
CopyFile(_T(temp_file_str), _T(des_file_str),false); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询