Scalabium Software |
|
| Knowledge for your independence'. | |
#114: How can I load a file list by some wildcard? |
|
After small delay with tip posting I want to continue this important task:-) Today I'll post a small sample which show how you can receive a list of files from some specific directory by some custom wildcard. For example, to load in listbox the bmp-files from Windows directory. procedure LoadFilesByMask(lst: TStrings; const SpecDir, WildCard: string);
var
intFound: Integer;
SearchRec: TSearchRec;
begin
lst.Clear;
intFound := FindFirst(SpecDir + WildCard, faAnyFile, SearchRec);
while intFound = 0 do
begin
lst.Add(SpecDir + SearchRec.Name);
intFound := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
For example, to load bmp-files from application folder:
|
|
|
Copyright© 1998-2025, Scalabium
Software. All rights reserved. |