To identify a running application from within Inno Setup you should really use a Mutex. -- see Inno documentation.
However, here is a function in Pascal that will accomplish what you want.
function FindWindowExtd(ApartialTitle: string): HWND;
var
hWndTemp: hWnd;
iLenText: Integer;
cTitletemp: array [0..254] of Char;
sTitleTemp: string;
begin
Result := 0;
hWndTemp := FindWindow(nil, nil);
while hWndTemp <> 0 do
begin
iLenText := GetWindowText(hWndTemp, cTitletemp, 255);
sTitleTemp := cTitletemp;
sTitleTemp := UpperCase(copy( sTitleTemp, 1, iLenText));
ApartialTitle := UpperCase(ApartialTitle);
if pos( ApartialTitle, sTitleTemp ) <> 0 then
begin
result := hWndTemp;
Exit;
end;
hWndTemp := GetWindow(hWndTemp, GW_HWNDNEXT);
end;
end;
Regards,
John