Hi!
I have a problem using SHFileOperator in the code below. It gives a “Cannot read from the source” exception on execution.
Please could anyone show me why?
Thanks in advance.Code:void CFileOperatorDlg::FileOperation() { BROWSEINFO bi; ::ZeroMemory(&bi, sizeof(bi)); TCHAR szSelPath[MAX_PATH]; bi.pszDisplayName = szSelPath; bi.lpszTitle = "Select the folder/file"; bi.ulFlags = BIF_BROWSEINCLUDEFILES | BIF_EDITBOX | BIF_RETURNFSANCESTORS | BIF_STATUSTEXT | BIF_VALIDATE ; LPITEMIDLIST pidlSrc = ::SHBrowseForFolder(&bi); char pathSrc[50]; SHGetPathFromIDList(pidlSrc,pathSrc); SHFILEOPSTRUCT shfos; shfos.hwnd = m_hWnd; shfos.wFunc = FO_COPY; shfos.pFrom = pathSrc; // a txt file shfos.fFlags = FOF_ALLOWUNDO; shfos.pTo = "D:\\h2.txt"; ::SHFileOperation(&shfos); }



LinkBack URL
About LinkBacks


