| 
      ...search a directory tree for a specified file?
     | 
   
   
    | Autor: 
      Thomas Stutz     | 
   
  | [ Print tip 
] |   |   |   
 
 
 
uses 
  ImageHlp; 
 
function SearchForFile(const ARootPath: string; 
                       const AFileName: string; 
                       var APathFound: string): Boolean; 
var 
  Found: array[0..500] of Char; 
begin 
  FillChar(Found, SizeOf(Found), #00); 
  Result := (SearchTreeForFile(PChar(ARootPath), PChar(AFileName), Found) = True); 
  APathFound := ExtractFilePath(Found); 
end; 
 
procedure TForm1.Button1Click(Sender: TObject); 
var 
  APathFound: string; 
begin 
  if SearchForFile('C:\WINDOWS\', 'winhlp32.exe', APathFound) then 
    ShowMessage('winhlp32.exe found in: ' + APathFound); 
end; 
 
 
  
                       |