Hľadanie inej aplikácie.

type 
  PFindWindowStruct = ^TFindWindowStruct; 
  TFindWindowStruct = record 
   Caption : string; 
   ClassName : string; 
   WindowHandle : THandle; 
  end; 
 
function EnumWindowsProc(hWindow : hWnd; 
                         lParam  : LongInt) : Bool 
{$IFDEF Win32} stdcall; {$ELSE} ; export; {$ENDIF} 
var 
  lpBuffer : PChar; 
  WindowCaptionFound : bool; 
  ClassNameFound : bool; 
 
begin 
  GetMem(lpBuffer, 255); 
  Result := True; 
  WindowCaptionFound := False; 
  ClassNameFound := False; 
 
  try 
   if GetWindowText(hWindow, lpBuffer, 255) > 0 then 
     if Pos(PFindWindowStruct(lParam).Caption, StrPas(lpBuffer)) > 0 
       then WindowCaptionFound := true; 
 
   if PFindWindowStruct(lParam).ClassName = '' then 
     ClassNameFound := True else 
       if GetClassName(hWindow, lpBuffer, 255) > 0 then 
         if Pos(PFindWindowStruct(lParam).ClassName, StrPas(lpBuffer)) 
           > 0 then ClassNameFound := True; 
 
   if (WindowCaptionFound and ClassNameFound) then begin 
     PFindWindowStruct(lParam).WindowHandle := hWindow; 
     Result := False; 
   end; 
 
  finally 
   FreeMem(lpBuffer, sizeof(lpBuffer^)); 
  end; 
end; 
 
function FindAWindow(Caption : string; ClassName : string) : THandle; 
var 
  WindowInfo : TFindWindowStruct; 
begin 
  WindowInfo.Caption := Caption; 
  WindowInfo.ClassName := ClassName; 
  WindowInfo.WindowHandle := 0; 
  EnumWindows(@EnumWindowsProc, LongInt(@WindowInfo)); 
  FindAWindow := WindowInfo.WindowHandle; 
end; 
 
procedure TForm1.Button1Click(Sender: TObject); 
var 
  TheWindowHandle : THandle; 
begin 
  TheWindowHandle := FindAWindow('EditPlus', ''); 
  if TheWindowHandle = 0 then 
   ShowMessage('Window Not Found!') else 
   BringWindowToTop(TheWindowHandle); 
end;