Vielleicht hilft dir das hier
Delphi-Quellcode:
function EnumWinProc(Wnd: hWnd): Boolean; StdCall;
var
WinCaption : Pchar;
WinHandle : string;
begin
GetMem(WinCaption, 255);
try
GetWindowText(Wnd, WinCaption, 255);
Result := True;
if (Trim(WinCaption) <> '') then
begin
WinHandle := IntToHex(Wnd, 6);
Form1.ListBox1.Items.add(WinHandle + ' : ' + WinCaption);
end;
finally
FreeMem(WinCaption, 255);
end;
end;
Jedoch werden alle Prozesse in eine Listbox eingtragen, doch du willst nur nach einem bestimmt EXE-Namen suchen, oder?
[Edit]Aufgerufen wird so:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWinProc, Application.Handle);
end;