Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimize a external application with Delphi

Is there a way to Minimize an external application that I don't have control over from with-in my Delphi application?

for example notepad.exe, except the application I want to minimize will only ever have one instance.

like image 975
Re0sless Avatar asked Sep 25 '08 13:09

Re0sless


1 Answers

You can use FindWindow to find the application handle and ShowWindow to minimize it.

var  
  Indicador :Integer;
begin 
  // Find the window by Classname
  Indicador := FindWindow(PChar('notepad'), nil);
  // if finded
  if (Indicador <> 0) then begin
    // Minimize
    ShowWindow(Indicador,SW_MINIMIZE);
  end;
end;
like image 164
Germán Estévez -Neftalí- Avatar answered Nov 15 '22 04:11

Germán Estévez -Neftalí-