![]() |
Verknüpfung (lnk) vollstädnig auslesen
Moin moin,
in ![]()
Delphi-Quellcode:
Da mir dieser Code soeben das Leben vereinfacht hat, hilft er vielleicht auch noch dem ein oder anderen...
uses ShlObj, ComObj, ActiveX;
function ReadLnkFile(const LnkFileName: String; out Path, Arguments, WorkingDirectory, Description: String; out HotKey: Word; out ShowCmd: Integer; out IconPath: String; out IconIndex: Integer): Boolean; var ShellLink: IShellLink; PersistFile: IPersistFile; FileInfo: TWin32FindData; begin Result:=False; if SUCCEEDED(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink, ShellLink)) then begin PersistFile := ShellLink as IPersistFile; if SUCCEEDED(PersistFile.Load(StringToOleStr(LnkFileName), STGM_READ)) then with ShellLink do begin SetLength(Path, MAX_PATH + 1); if SUCCEEDED(GetPath(PChar(Path), MAX_PATH, FileInfo, SLR_ANY_MATCH)) then begin Path := PChar(Path); Result := True; SetLength(Arguments, MAX_PATH + 1); GetArguments(PChar(Arguments), MAX_PATH); Arguments := PChar(Arguments); SetLength(WorkingDirectory, MAX_PATH + 1); GetWorkingDirectory(PChar(WorkingDirectory), MAX_PATH); WorkingDirectory := PChar(WorkingDirectory); SetLength(Description, MAX_PATH + 1); GetDescription(PChar(Description), MAX_PATH); Description := PChar(Description); GetHotkey(HotKey); GetShowCmd(ShowCmd); SetLength(IconPath, MAX_PATH + 1); GetIconLocation(PChar(IconPath), MAX_PATH, IconIndex); IconPath := PChar(IconPath); if IconPath = '' then IconPath := Path; end else Path := ''; end; end; end; Grüße Malte [edit=Dax]Beitrag direkt in die Codelib verschoben - konnte genau so übernommen werden. Danke! :) bedah, Dax[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:52 Uhr. |
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