檔案刪除並將檔案移到資源回收筒
重點在要 pFrom 送雙0結尾的字串
(也就是4個 byte的0x00 )
SHFILEOPSTRUCT so;
WCHAR wFileName[512];
wmemset( wFileName, 0, 512);
wmemcpy( wFileName, L"D:\\201505111024.data", 19);
memset( &so, 0, sizeof(SHFILEOPSTRUCT));
so.wFunc = FO_DELETE;
so.fFlags = FOF_ALLOWUNDO; // | FOF_NOCONFIRMATION;
so.pFrom = wFileName;
so.fAnyOperationsAborted = true;
int nCode = ::SHFileOperation( &so);
沒有留言:
張貼留言