What is the sequence of events fired when Windows Explorer opens a directory?
- The directory to enumerate is opened. If the metadata cache isn't used, and the directory isn't already open (in parallel by this or another process), then the GetFileInfo event fires. Next, the OpenFile event fires.
- The EnumerateDirectory event fires one or more times.
- The CloseDirectoryEnumeration event fires after your EnumerateDirectory event handler reports that no more directory entries are available.
- The CloseFile event fires.
Note that when a user navigates to a directory, Windows Explorer will also attempt to read metadata and (depending on the file type) thumbnails from the files. This means that Windows Explorer often opens files in the directory being enumerated, and reads data from said files, during the enumeration process.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at firstname.lastname@example.org.