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. FindFirstFile not working

FindFirstFile not working

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

    WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

    J L G J D 5 Replies Last reply
    0
    • S sachanratnesh

      WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      In case of errors call GetLastError() to know about the reason of the failure. To get the corresponding error message use FormatMessage(). When not using FormatMessage() you can lookup the error number in WinError.h to get the english error message. Don't forget to close the returned handle using FindClose() when a search operation has been finished.

      1 Reply Last reply
      0
      • S sachanratnesh

        WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        See the comments abot Return Value at http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx[^].

        Veni, vidi, abiit domum

        1 Reply Last reply
        0
        • S sachanratnesh

          WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

          G Offline
          G Offline
          Gisle Vanem
          wrote on last edited by
          #4

          "*?*" is the same as "*" under Win-XP at least. Did you hope for something else?

          Gisle V.
          # rm -vf /bin/laden /bin/rm: success

          1 Reply Last reply
          0
          • S sachanratnesh

            WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

            J Offline
            J Offline
            Joe Woodbury
            wrote on last edited by
            #5

            Check what the current directory is.

            1 Reply Last reply
            0
            • S sachanratnesh

              WIN32_FIND_DATAA data; HANDLE h = FindFirstFile(".\\images\\*?*",&data); This is returning a INVALID_HANDLE_VALUE handler. in Window XP while in Windows 7 it is working fine. In XP if you will run this use case it will work. but after doing another some use case and then will run it it will give exception.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              sachanratnesh wrote:

              HANDLE h = FindFirstFile(".\\images\\*?*",&data);

              Are you confusing relative vs. absolute paths? Since you are using the former, does the "images" folder exist in the same folder as the exe that is running?

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

              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