Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#235

AW: Ordnung muss sein (LaunchBar)

  Alt 16. Aug 2018, 05:45
Zitat:
oder mit SHGetFileInfo ein Handle zu dem richtigen Icon zu bekommen.
Ich bekomme aber das vom Installer warum auch immer.
Selber habe ich keinen Einfluss darauf wie Anwendungen ihre ShortCuts bzw.. Links erstellen.
Siehe Anhang als Beispiel.

Von der Anwendung bekomme ich das Icon vom Installer zurück geliefert.
Delphi-Quellcode:
procedure TWin32ShortCut.LoadShortCut(LnkName: WideString);
var
  FP: array[0..MAX_PATH * 2] of Char;
  pfd: TWin32FindDataW;
  showval: integer;
  psfi: TSHFileInfo;
begin
  ClearValues;
  FPersistFile.Load(PWideChar(LnkName), 0);

  FillChar(FP, Sizeof(FP), 0);
  FShellLink.GetPath(FP, Sizeof(FP), pfd, 0);
  FAppPath := String(FP);

  FShellLink.GetIDList(Fpidl);

  FillChar(FP, Sizeof(FP), 0);
  FShellLink.GetWorkingDirectory(FP, Sizeof(FP));
  FWorkDirectory := String(FP);

  FillChar(FP, Sizeof(FP), 0);
  FShellLink.GetArguments(FP, Sizeof(FP));
  FArguments := String(FP);

  FillChar(FP, Sizeof(FP), 0);
  FShellLink.GetDescription(FP, Sizeof(FP));
  FDescription := String(FP);

  FShellLink.GetShowCmd(showval);
  FShowCmd := cvtTShowType(showval);

  FShellLink.GetHotkey(FHotKey);
  HotKeyToShortCut(FHotKey, FHotKeyCtrl);


  FillChar(FP, Sizeof(FP), 0);
  FShellLink.GetIconLocation(FP, Sizeof(FP), FIconIndex); // <<<<< und zwar hier FP
  FIconPath := String(FP);

  if FIconPath = 'then
    begin
      SHGetFileInfo(PChar(FAppPath), 0, psfi, sizeof(psfi), SHGFI_ICON);
      FIcon.Handle := psfi.hIcon;
    end
  else
    FIcon.Handle := ExtractIcon(hInstance, PChar(FIconPath), FIconIndex);
end;
Zitat:
Ich hatte aber auch noch nie ein Problem damit diese Links per ShellExecute auszuführen
Es geht nicht um die Ausführung da habe ich auch kein Problem sondern um das auffinden des richtigen Pfades incl. des Icon.

gruss

Geändert von EWeiss (11. Jul 2019 um 15:52 Uhr)
  Mit Zitat antworten Zitat