Jump to content

robertjohns

Members
  • Content Count

    74
  • Joined

  • Last visited

Everything posted by robertjohns

  1. robertjohns

    Find String in TstringList

    There are no non-printable characters around extensions
  2. robertjohns

    Form Creation

    Yes Exactly I create a Splash Form and free it then check If Splash is created before creating login form
  3. robertjohns

    Form Creation

    I have just give an Example .. I know I can't free MainForm .. I have simply given the name here Form1 and Form2
  4. robertjohns

    Find String in TstringList

    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
  5. robertjohns

    Find String in TstringList

    Thanks but Same issue as previous attempts
  6. robertjohns

    Find String in TstringList

    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;
  7. robertjohns

    Form Creation

    No I am not freeing MainForm Form2 is MainForm .. I am trying to check If Form1 is created then create Form2 which is Mainform
  8. robertjohns

    File Search

    Same result not excludes
  9. robertjohns

    File Search

    Thanks but it still search the windows directory even after Exclusion
  10. robertjohns

    File Search

    @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
  11. robertjohns

    File Search

    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'
  12. robertjohns

    File Search

  13. robertjohns

    File Search

    Is there any way to search C:\ Driver with all sub-directories but skip Windows directory ?
  14. robertjohns

    File Search

    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
  15. robertjohns

    File Search

    Thanks it keeps repeating the search in folders again and again and never ends I tried C:\ '*.*'
  16. robertjohns

    File Search

    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
  17. robertjohns

    File Search

    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
  18. robertjohns

    File Search

    In Delphi Tokyo for var LPattern in APatternToSearch do does not work and what is LPattern ? , Undeclared identifier: 'LPattern'
  19. robertjohns

    File Search

    Possible to do the same with this function ?
  20. robertjohns

    File Search

    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;
  21. robertjohns

    File Search

    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
  22. robertjohns

    File Search

    What is files: TStringDynArray; and how to loop different file name ?
  23. robertjohns

    File Search

    I have tried changing SR.Attr to faDirectory too the result is always empty
  24. robertjohns

    File Search

    Thanks for your reply .. but I have already tried all these method none worked to search for direct file name
  25. robertjohns

    File Search

    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;
×