Enumerate all

This is a discussion on Enumerate all within the Windows Programming forums, part of the Platform Specific Boards category; Hi! I want to write a code to enumerate through all the folders in the Windows shell, to find a ...

  1. #1
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362

    Enumerate all

    Hi!
    I want to write a code to enumerate through all the folders in the Windows shell, to find a specific file. I know how to navigate to any folder using things like IShellFolder and IEnumIdList interfaces, FindFirstFile and FindNextFile functions, but donít know how to write it to begin at the desktop and go automatically through each and every folder in the shell. Can anyone point me to a code or an article that explain this kind of enumeration? Or give me some instructions for doing it?
    Thanks in advance.
    Last edited by geek@02; 06-10-2004 at 09:39 AM. Reason: ----

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    >> but donít know how to write it to begin at the desktop
    For those who are confused, I believe he means "desktop" as in, the root of the tree control in windows explorer.

    We'll start with the drives under "My Computer".
    GetLogicalDrives()
    GetDriveType()
    GetVolumeInformation()

    gg

  3. #3
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    Thanks for that.
    Actually, Iím mostly confused about the algorithm that automates the navigation. If you can show me the basic structure of the algorithm, it would be a great help.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    >> I know how to navigate to any folder using things like IShellFolder and IEnumIdList interfaces, FindFirstFile and FindNextFile functions
    ...
    >>Iím mostly confused about the algorithm that automates the navigation

    This doesn't make alot of sense - you now know how to search every single file on every single storage device on your computer - what else do you want to do??

    gg

  5. #5
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    If Iím to right a code to go to and find files in a folder any where in the hierarchy in a direct manner, Iím all right. For example, I can find my way to C:\Program Files\WinZip, and find all the text files there. But if I have to write it to enumerate through all the folders under C:\ in the hierarchy, and find all the text files within C:\, I canít figure out how to do that.

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    There's a win32 example at the bottom of the page in this cprog faq (Accessing a directory and all the files within it) that you may find helpful.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    >>I know how to navigate to any folder using things like ... FindFirstFile and FindNextFile functions
    There's the disconnect - FindFirstFile() and FindNextFile() is how you do it

    Here is a tutorial on the API's that might help as well.

    gg

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You should also just do yourself a favor get the Platform SDK since it has thorough examples of how to do this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to enumerate all permulations
    By patiobarbecue in forum C Programming
    Replies: 3
    Last Post: 01-12-2009, 07:55 PM
  2. [code] Enumerate IE instances and retrieve interfaces.
    By anonytmouse in forum Windows Programming
    Replies: 1
    Last Post: 05-05-2004, 08:01 AM
  3. Enumerate ALL CD-drives
    By Steph in forum Windows Programming
    Replies: 3
    Last Post: 06-04-2003, 12:24 AM
  4. Enumerate type
    By dv007 in forum C Programming
    Replies: 8
    Last Post: 07-15-2002, 03:32 PM
  5. Replies: 1
    Last Post: 05-28-2002, 11:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21