我在C++、MFC、Windows下编程。我想删除一个文件夹到回收站。我该怎么做?CStringfilePath=directorytoBeDeletePath;TCHARToBuf[MAX_PATH+10];TCHARFromBuf[MAX_PATH+10];ZeroMemory(ToBuf,sizeof(ToBuf));ZeroMemory(FromBuf,sizeof(FromBuf));lstrcpy(FromBuf,filePath);SHFILEOPSTRUCTFileOp;FileOp.hwnd=NULLFileOp.wFunc=FO_DELETE;FileOp.pFro
我使用以下代码删除文件。效果很好。SHFILEOPSTRUCTFileOp;ZeroMemory(&FileOp,sizeof(SHFILEOPSTRUCT));FileOp.hwnd=m_hAppHandle;FileOp.wFunc=FO_DELETE;//deleteFileOp.pFrom=szPath;FileOp.pTo=NULL;FileOp.fFlags=FOF_NOCONFIRMATION|FOF_NOERRORUI;FileOp.fAnyOperationsAborted=FALSE;FileOp.hNameMappings=NULL;FileOp.lpszProg
为了使用SHFileOperation,我需要将一个字符串格式化为以null结尾的双字符串。有趣的是我发现了以下其中一项工作,但不是同时工作://Example1CStringszDir(_T("D:\\Test"));szDir=szDir+_T('\0')+_T('\0');//Example2CStringszDir(_T("D:\\Test"));szDir=szDir+_T("\0\0");//DeletefolderSHFILEOPSTRUCTfileop;fileop.hwnd=NULL;//nostatusdisplayfileop.wFunc=FO_DELETE;//