processlist WindowTitle property
Return to Introduction  Previous page  Next page
Applies to
acProcess object.  

Declaration
property WindowTitle: String; // read-only!  

Description
The WindowTitle property detemines the caption of the first visible window which belongs to process.  
 
To retrieve the full list of windows which belongs to the process — use Windows property.  

How does this property works? (exact code sample)
function TacProcess.GetWindowTitle: String;  
var  
  I: Integer;  
begin  
  if AppType = atExplorer then  
    Result := 'Windows Explorer'  
  else  
   if CaseAnsiCompareText(ExtractFilename(FExeName), 'systray.exe') = 0 then  
     Result := 'System tray'  
   else  
    begin  
     Result := '';  
     if High(Windows) >= 0 then // if application have windows  
      begin  
       // Return the window title of the first visible window  
       // whose title is non-empty  
       for I := 0 to High(Windows) do  
        if IsWindowVisible(Windows[I]) then  
         begin  
          Result := acUtils.GetWindowTitle(Windows[I]);  
          if Result <> '' then Exit;  
         end;  
 
       // Nothing yet? Then return the window title of the first  
       // window, visible or otherwise, that is non-empty  
       for I := 0 to High(Windows) do  
        begin  
         Result := acUtils.GetWindowTitle(Windows[I]);  
         if Result <> '' then Exit;  
        end;  
      end;  
    end;  
end;  

See also
Windows property.