question on SHFILEOPSTRUCT
-
i have something wrong but not sure what to look for. the directory that i am passing is vaild (i can use _rmdir() and it works using the same variable. but my problem is that i do not know how may files or sub-diretories may be in the the folder that i wish to delete. From what i understand this function will delete folders that have contents. i have been trying to delete for now an empty folder dirname = c:\\junk when i run SHFileOperation() i get: Cannot Delete File: File System Error(1026) if i check the attributes on the directory there is nothing checked. thank you for any help SHFILEOPSTRUCT shf; memset(&shf,0,sizeof(shf)); shf.hwnd = mywindow::GetSafeHwnd(); shf.wFunc = FO_DELETE; shf.pFrom = dirname;///////////////this is a valid directory shf.fFlags = FOF_SIMPLEPROGRESS | FOF_NOCONFIRMATION ; int shfret = SHFileOperation(&shf);
-
i have something wrong but not sure what to look for. the directory that i am passing is vaild (i can use _rmdir() and it works using the same variable. but my problem is that i do not know how may files or sub-diretories may be in the the folder that i wish to delete. From what i understand this function will delete folders that have contents. i have been trying to delete for now an empty folder dirname = c:\\junk when i run SHFileOperation() i get: Cannot Delete File: File System Error(1026) if i check the attributes on the directory there is nothing checked. thank you for any help SHFILEOPSTRUCT shf; memset(&shf,0,sizeof(shf)); shf.hwnd = mywindow::GetSafeHwnd(); shf.wFunc = FO_DELETE; shf.pFrom = dirname;///////////////this is a valid directory shf.fFlags = FOF_SIMPLEPROGRESS | FOF_NOCONFIRMATION ; int shfret = SHFileOperation(&shf);
The
pFrom
member is a "multistring", i.e a string composed of many substrings terminated by'\0'
s. In your particular case, there's only one substring terminated by'\0'
plus the standard'\0'
regular C strings are equipped with. So, try with"c:\\junk\0"
and tell us if that worked. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo