Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Verknüpfungen (shortcuts) lesen (https://www.delphipraxis.net/11874-verknuepfungen-shortcuts-lesen.html)

Aike 4. Aug 2005 14:56

Re: Verknüpfungen (shortcuts) lesen
 
Delphi-Quellcode:
uses ShlObj, ComObj, ActiveX;
 
function GetLinkDestination(s: WideString): string;
var aShellLink  : IShellLink;
    aPersistFile : IPersistFile;
    szData      : array[0 .. MAX_PATH] of char;
    aFindData   : TWin32FindData;
begin
  aShellLink := CreateComObject(CLSID_ShellLink) as IShellLink;
  aPersistFile := aShellLink as IPersistFile;

  OleCheck(aPersistFile.Load(PWidechar(s),STGM_READ));
  OleCheck(aShellLink.GetPath(szData,MAX_PATH,aFindData,SLGP_SHORTPATH));

  Result := szData;
end;
Allererste Sahne. Funktioniert einwandfrei, gibt aber wegen "SLGP_SHORTPATH" (wie erwähnt) nur 8-Zeichen-lange Pfade zurück, stört aber nicht beim Ausführen von Dateien.


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:00 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz