Check if windows explorer already opened on given path

Viewed 1309

How can I see if windows explorer is already opened with certain path ? I don't want my application opens many duplicated windows. I was unable to do it with this way :

var
  H: hwnd;
begin
  if FileExists(edt8.Text) then
  begin
    H := FindWindow(0, PChar(ExtractFilePath(edt8.Text)));
    if H <> 0 then
      ShowMessage('explorer already opened')//explorer bring to front
    else
      ShellExecute(Application.Handle, nil, 'explorer.exe',
        PChar(ExtractFilePath(edt8.Text)), nil, SW_NORMAL);
  end;
end;
1 Answers
Related