SolFSStorage.FindFirst method
Filter:
Pascal DLL C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
Searches for the first instance of a file name with a given set of attributes in a specified SolFS storage.
Declaration
[Pascal]
function FindFirst(var Search: TStorageSearch; const Mask: WideString; Attributes: LongWord): Boolean;
[DLL]
long _stdcall StorageFindFirst(unsigned long Storage, PStorageSearch Search, wchar_t* Mask, unsigned long Attributes);
[C++ (DLL/Lib)]
bool FindFirst(StorageSearch & Search, unsigned short *Mask, unsigned long Attributes)
[C++ (VCL)]
bool __fastcall FindFirst(TStorageSearch & Search, const WideString Mask, unsigned Attributes);
[C++ (.NET)]
bool FindFirst(String *FileMask, unsigned long Attributes, StorageSearch & Search)
[C#]
bool FindFirst(string fileMask, uint attributes, StorageSearch search)
[VB.NET]
Function FindFirst(ByVal fileMask As String, ByVal attributes As System.UInt32, ByRef search As StorageSearch) As Boolean
Parameters
- Attributes - specifies what do we overhaul: files, directories or both. Values:
- Mask - the full file name mask, including wildcard characters. To use several streams in the file see Files and streams.
- Search - returns result of searching.
Values of Attributes
[Pascal] [DLL] [C++ (VCL)] [C++ (.NET)] [C#] [VB.NET] [ActiveX] [VB]
Value
Description
Can be set with SetFileAttributes
attrFile
1 (0x1)
Specifies that the entry is a file
no
attrDirectory
2 (0x2)
Specifies that the entry is a directory
no
attrCompressed
8 (0x8)
Specifies that the file is compressed
no
attrEncrypted
16 (0x10)
Specifies that the file is encrypted
no
attrSymLink
32 (0x20)
Specifies that the entry is a symbolic link
no
attrReadOnly
64 (0x40)
Specifies that the file is read-only. The attribute is not used by SolFS.
yes
attrArchive
128 (0x80)
Specifies that the file requires archiving. The attribute is not used by SolFS.
yes
attrHidden
256 (0x100)
Specifies that the file is hidden. The attribute is not used by SolFS.
yes
attrSystem
512 (0x200)
Specifies that the file is system. The attribute is not used by SolFS.
yes
attrTemporary
1024 (0x400)
Specifies that the file is temporary. The attribute is not used by SolFS.
yes
attrDeleteOnClose
2048 (0x800)
Specifies that the file should be deleted when the last handle to the file is closed. The attribute is currently not supported by SolFS.
yes
attrReserved0
0x1000
Reserved for future use
no
attrReserved1
0x2000
Reserved for future use
no
attrReserved2
0x4000
Reserved for future use
no
attrReserved3
0x8000
Reserved for future use
no
attrNoUserChange
attrFile | attrDirectory | attrDataTree | attrCompressed | attrEncrypted | attrSymLink | attrReserved0 | attrReserved1 | attrReserved2 | attrReserved3
Thse attributes can't be changed with SetFileAttributes
no
attrUserDefined
0xFFFF0000
A mask that specifies user-defined attributes
yes
attrAnyFile
0xFFFFFFFF
A mask that specifies entries with any attributes
Return value
True if a file was successfully located.
False if no files have been found.
[DLL]
0 if the function succeeded or one of Error codes if the function failed.
Description
FindFirst searches the directory specified by Mask for the first file that matches the file name Mask and the attributes specified by the Attributes parameter.
Note, that to find files without extension (for example a file with the name "JustAFileWithoutExtension"), you will need so specify "*" in Mask. Specifying "*.*" will not locate this file.
If you want to include folders into results, you need to add attrDirectory to Attributes, otherwise folders will not be included.
The result is returned in the Search parameter. Use the fields of this search record to extract the information needed.
When you finish enumeration, remember to call FindClose.
Calling this method is not necessary, if FindFirst returned False ([DLL] "errNoMoreFiles" error code).
