![]() |
Eine Verknüpfung erstellen
Delphi-Quellcode:
Benötigt wird die Unit ShlOBJ.
uses
ActiveX; function CreateLink(lpszPathObj,lpszPathLink, lpszDesc: string):Boolean; var psl: IShellLink; ppf: IPersistFile; const IID_IPersistFile: TGUID = (D1:$0000010B; D2:$0000; D3:$0000; D4:($C0,$00,$00,$00,$00,$00,$00,$46)); begin result := False; if SUCCEEDED(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IID_IShellLinkA, psl)) then begin psl.SetPath(PChar(lpszPathObj)); psl.SetDescription(PChar(lpszDesc)); if SUCCEEDED(psl.QueryInterface(IID_IPersistFile, ppf)) then begin ppf.Save(StringToOLEStr(lpszPathLink),TRUE); Result := true; ppf._Release; //---> Runtime-Error wenn aktiv end; end; psl._Release; // ---> Runtime-Error wenn aktiv end; //Aufruf: if CreateLink('d:\Datei.exe', 'c:\Verknüpfung.exe', 'Verknüpfung') then MessageDlg('Verknüpfung angelegt', mtInformation, [mbOk], 0); Dieser Code wurde ![]() ![]() ![]() [edit=Chakotay1308]Mfg, Chakotay1308[/edit] [edit=sakura] uses hinzugefügt. Mfg, sakura[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:51 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 by Thomas Breitkreuz