SolFSStorage.FindFirst method


Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    


Searches for the first instance of a file name with a given set of attributes in a specified storage.


    function FindFirst(var Search: TStorageSearch; const Mask: TSolFSString; Attributes: LongWord): Boolean;

[Plain C]
    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 TSolFSString Mask, unsigned Attributes);

[C++ (.NET)]
    bool FindFirst(String *FileMask, long Attributes, StorageSearch & Search)

    bool FindFirst(string fileMask, Int32 attributes, StorageSearch search)

    Function FindFirst(ByVal fileMask As String, ByVal attributes As Integer, ByRef search As StorageSearch) As Boolean

    boolean findFirst( SolFSStorageSearch search, String mask, long attributes )


  • 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.
  • [Plain C] Storage - handle to the storage returned by Create or Open function.

Values of Attributes

Return value

    True if a file was successfully located.
    False if no files have been found.
     [Plain C]  0 if the function succeeded or one of Error codes if the function failed.


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).

See also

Files and streams     FindFirstEx     FindClose     FindNext