Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. question on SHFILEOPSTRUCT

question on SHFILEOPSTRUCT

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jafrazee
    wrote on last edited by
    #1

    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);

    J 1 Reply Last reply
    0
    • J jafrazee

      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);

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups