Fires after a directory entry is returned during directory enumeration.
type TAfterEnumerateDirectoryEvent = procedure ( Sender: TObject; const DirectoryName: String; const FileName: String; var CreationTime: TDateTime; var LastAccessTime: TDateTime; var LastWriteTime: TDateTime; var ChangeTime: TDateTime; var Size: Int64; var AllocationSize: Int64; var FileId: Int64; var Attributes: Integer; var Status: Integer; var DirectoryContext: Pointer; var HandleContext: Pointer; var EnumerationContext: Pointer; var ProcessRequest: Boolean; var ResultCode: Integer ) of Object;
property OnAfterEnumerateDirectory: TAfterEnumerateDirectoryEvent read FOnAfterEnumerateDirectory write FOnAfterEnumerateDirectory;
This event fires after a directory entry (i.e., a file or subdirectory) is returned during enumeration of the directory specified by DirectoryName.
Applications may use this event to modify the entry's metadata before it gets reported to the requestor, or even prevent the entry from being reported in the first place.
The FileName parameter reflects the name of the directory entry.
The CreationTime, LastAccessTime, LastWriteTime, and ChangeTime parameters specify the entry's time values, specified in UTC.
The Size parameter specifies the size of the file, in bytes; it must always be 0 for subdirectories.
The AllocationSize parameter specifies the amount of space allocated for the file, in bytes; it must always be 0 for subdirectories.
The FileId parameter specifies the unique Id of the entry, as reported by the filesystem (or, for virtual files, by the application itself). This Id is used by the network redirector, and some third-party applications, to open files and directories by Id instead of by name. The root directory always uses the predefined Id 0x7FFFFFFFFFFFFFFF.
The Attributes parameter specifies the entry's attributes; please refer to Microsoft's File Attribute Constants article for attribute descriptions.
The Status parameter contains an NT status code that indicates the outcome of the operation; 0 indicates success. To convert this value to a Win32 error code, call the NtStatusToWin32Error method. Please note that this event won't fire for failed requests unless the ProcessFailedRequests property is enabled. Applications may change this parameter's value if they want a different NT status code to be returned.
The DirectoryContext, HandleContext, and EnumerationContext parameters are placeholders for application-defined data associated with the directory, specific handle, and enumeration; respectively. (For general-purpose events, the DirectoryContext is called FileContext instead.) DirectoryContext corresponds to the FileContext in the file/directory creation, opening, and closing events. Please refer to the Contexts topic for more information.
The ProcessRequest parameter controls whether the directory entry should actually be reported to the requestor; it is True by default. Setting this parameter to False will "hide" the directory entry (i.e., prevent it from being reported).
The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.
This event is fired synchronously; please refer to the Event Types topic for more information.