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. Cannot remove directory

Cannot remove directory

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 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.
  • W Offline
    W Offline
    Wim Engberts
    wrote on last edited by
    #1

    Hi all, In a program I use "RemoveDirectory (LPCTSTR szName)" to remove a directory. However, this never seems to work. GetLastError () claims that "the process cannot access the file because it is being used by another process", which is not the case. I have no problem in removing the same directory from either a command-line or from the explorer. I am sure that the directory is empty (this is done in a preceeding bit of code in the same program). Anyone any ideas? Thanks in advance, William

    K 1 Reply Last reply
    0
    • W Wim Engberts

      Hi all, In a program I use "RemoveDirectory (LPCTSTR szName)" to remove a directory. However, this never seems to work. GetLastError () claims that "the process cannot access the file because it is being used by another process", which is not the case. I have no problem in removing the same directory from either a command-line or from the explorer. I am sure that the directory is empty (this is done in a preceeding bit of code in the same program). Anyone any ideas? Thanks in advance, William

      K Offline
      K Offline
      kakan
      wrote on last edited by
      #2

      Wim Engberts wrote:

      I am sure that the directory is empty (this is done in a preceeding bit of code in the same program).

      A missing FindClose(), maybe?

      Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

      W 1 Reply Last reply
      0
      • K kakan

        Wim Engberts wrote:

        I am sure that the directory is empty (this is done in a preceeding bit of code in the same program).

        A missing FindClose(), maybe?

        Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

        W Offline
        W Offline
        Wim Engberts
        wrote on last edited by
        #3

        You are absolutely right! Never thought I'd need that after FindNext returned FALSE! Thank you very much. William

        K 1 Reply Last reply
        0
        • W Wim Engberts

          You are absolutely right! Never thought I'd need that after FindNext returned FALSE! Thank you very much. William

          K Offline
          K Offline
          kakan
          wrote on last edited by
          #4

          You are welcome. :cool:

          Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

          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