-
Content Count
74 -
Joined
-
Last visited
Everything posted by robertjohns
-
There are no non-printable characters around extensions
-
Yes Exactly I create a Splash Form and free it then check If Splash is created before creating login form
-
I have just give an Example .. I know I can't free MainForm .. I have simply given the name here Form1 and Form2
-
function ContainsStr(const AStrings : TStrings; const ASearchStr : String) : Boolean; var LIdx : Integer; begin Result := Pos( ASearchStr, AStrings.Text ) > 0; if Result then begin for LIdx := 0 to AStrings.Count - 1 do if Pos( ASearchStr, AStrings[LIdx] ) > 0 then Exit; Result := False; end; end; This function does the job but it find matching strings not the exact search strings If StringList have some other and if Search strings are some.pds ad other.cff , Result is always True because it matches the strings with some and other whereas I expect it to find some.pds ad other.cff , Result should return False
-
Thanks but Same issue as previous attempts
-
for I := 0 to strList.Count -1 do if (Pos('some.pds',strList[i])>0) or (Pos('other.cff',strList[i])>0) Then Result:=True else Result:=False; for I := 0 to strList.Count -1 do If (strList[I].Contains('some.pds')) or (strList[I].Contains('other.cff')) Then Result:=True else Result:=False; for I := 0 to strList.Count -1 do If (SameText('some.pds',strList[i])) or (SameText('other.cff',strList[i])) Then Result:=True else Result:=False; function ContainsStr(const AStrings : TStrings; const ASearchStr : String) : Boolean; var LIdx : Integer; begin Result := Pos( ASearchStr, AStrings.Text ) > 0; if Result then begin for LIdx := 0 to AStrings.Count - 1 do if Pos( ASearchStr, AStrings[LIdx] ) > 0 then Exit; Result := False; end; end;
-
No I am not freeing MainForm Form2 is MainForm .. I am trying to check If Form1 is created then create Form2 which is Mainform
-
Same result not excludes
-
Thanks but it still search the windows directory even after Exclusion
-
@programmerdelphi2k Actually I am after the Delphi Search File function which will search all the directories and sub-directories in Drive C:\ excluding Windows Folder [need to skip Windows folder from search] Like the normal cmd command does dir /S /B /A:-D *.exe | findstr /V /I /C:"\\Windows\\" But None of the Delphi function does the same , when Search starts it search in Windows folder too
-
Thanks but actually not working in Delphi E2010 Incompatible types: 'Winapi.Windows._FINDEX_INFO_LEVELS' and 'Unit1._FINDEX_INFO_LEVELS' E2010 Incompatible types: 'Winapi.Windows._FINDEX_SEARCH_OPS' and 'Unit1._FINDEX_SEARCH_OPS'
-
Is there any way to search C:\ Driver with all sub-directories but skip Windows directory ?
-
But I am using MyFindFilePattern('C:', ['*.*'], LMyResult); It still keep repeating search files in the directories and sub-directors again and again and never ends like dir A dir B dir C sub dir a sub dir b sub dir c .... dir A dir B dir C sub dir a sub dir b sub dir c .... and never ends keeps going on again and again
-
Thanks it keeps repeating the search in folders again and again and never ends I tried C:\ '*.*'
-
This line does not work in Tokyo MyFindFilePattern('d:\MyZip', ['*.*', '*.txt', '*.zip'], LMyResult); ListBox1 .Items.AddStrings(LMyResult); There is no overloaded version of 'AddStrings' that can be called with these arguments
-
oh! I tested this code .. this does the same task what the codes does I posted in my first post. Actually I am trying to get all the files from Drive C:\ from its all directories and sub-directories even from special and hidden folders and this function fails for it
-
In Delphi Tokyo for var LPattern in APatternToSearch do does not work and what is LPattern ? , Undeclared identifier: 'LPattern'
-
Possible to do the same with this function ?
-
How can I declare and use Array of Strings instead of pattern : String in below function and then how to call it with array of strings ? procedure FindFilePattern(root:String;pattern:String); var SR:TSearchRec; begin root:=IncludeTrailingPathDelimiter(root); if FindFirst(root+'*',faAnyFile,SR) = 0 then begin repeat Application.ProcessMessages; if ((SR.Attr and faDirectory) = faDirectory ) and (pos('.',SR.Name)=0) then FindFilePattern(root+SR.Name,pattern) else begin if pos(pattern,SR.Name)>0 then Form1.ListBox1.Items.Add(Root+SR.Name); end; until FindNext(SR)<>0; end; end;
-
Function I have mentioned in my first post also works well I just need to find any modification in it to search by filename instead of filemask Even I tried if FindFirst(root+pattern,faAnyFile,SR) = 0 then .. but not working
-
What is files: TStringDynArray; and how to loop different file name ?
-
I have tried changing SR.Attr to faDirectory too the result is always empty
-
Thanks for your reply .. but I have already tried all these method none worked to search for direct file name
-
I am using Delphi 10.2 Is it possible to search Directories and Sub-Directories by File Name instead File Mask like mytext.txt instead of *.txt So far I tried the following function but it does not work by filename it works with file extension another issue with this function is that it does not list the complete searched files from Windows\system32\drivers\ procedure FindFilePattern(root:String;pattern:String); var SR:TSearchRec; begin root:=IncludeTrailingPathDelimiter(root); if FindFirst(root+'*',faAnyFile,SR) = 0 then begin repeat Application.ProcessMessages; if ((SR.Attr and faDirectory) = SR.Attr ) and (pos('.',SR.Name)=0) then FindFilePattern(root+SR.Name,pattern) else begin if pos(pattern,SR.Name)>0 then Form1.ListBox1.Items.Add(Root+SR.Name); end; until FindNext(SR)<>0; end; end; procedure TForm1.Button1Click(Sender: TObject); begin FindFilePattern('C:\','.sys'); end;