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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Close Handle and FindClose

Close Handle and FindClose

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 4 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.
  • A Offline
    A Offline
    ashokvishnu
    wrote on last edited by
    #1

    Hi Gurus, While using FindFile, FindFirstFile, CreateDirectory functions, if the return is INVALID_HANDLE_VALUE do we still need to use the CloseHandle or FindClose functions to close the handle anyways? Thanks

    C++beginer

    N H 2 Replies Last reply
    0
    • A ashokvishnu

      Hi Gurus, While using FindFile, FindFirstFile, CreateDirectory functions, if the return is INVALID_HANDLE_VALUE do we still need to use the CloseHandle or FindClose functions to close the handle anyways? Thanks

      C++beginer

      N Offline
      N Offline
      NiceNaidu fo
      wrote on last edited by
      #2

      ashokvishnu wrote:

      if the return is INVALID_HANDLE_VALUE

      Yes..you need to CloseHandle even if the value is INVALID_HANDLE_VALUE

      Appu.. "If you judge people, you have no time to love them."

      M 1 Reply Last reply
      0
      • A ashokvishnu

        Hi Gurus, While using FindFile, FindFirstFile, CreateDirectory functions, if the return is INVALID_HANDLE_VALUE do we still need to use the CloseHandle or FindClose functions to close the handle anyways? Thanks

        C++beginer

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Did you see MSDN? From the MSDN: "INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError."

        _**


        **_

        whitesky


        1 Reply Last reply
        0
        • N NiceNaidu fo

          ashokvishnu wrote:

          if the return is INVALID_HANDLE_VALUE

          Yes..you need to CloseHandle even if the value is INVALID_HANDLE_VALUE

          Appu.. "If you judge people, you have no time to love them."

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Um, no. If you get a return value of INVALID_HANDLE_VALUE, it means the function failed.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          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