Ich verwende folgenden Code um eine Verknüfung zu erstellen.
Das funktioniert auch ganz gut so lange keine Umlaute im Spiel sind.
Code: Alles auswählen
function CreateLink(const AFilename, ALNKFilename, ADescription: string): Boolean;
var
psl: IShellLink;
ppf: IPersistFile;
wsz: PWideChar;
begin
result := false;
if SUCCEEDED(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_inPROC_SERVER, IID_IShellLinkA, psl)) then
begin
psl.SetPath(PChar(AFilename));
psl.SetDescription(PChar(ADescription));
psl.SetWorkingDirectory(PChar(ExtractFilePath(AFilename)));
if SUCCEEDED(psl.QueryInterface(IPersistFile, ppf)) then
begin
GetMem(wsz, MAX_PATH * 2);
try
MultiByteToWideChar(CP_ACP, 0, PChar(ALNKFilename), -1, wsz, MAX_PATH);
ppf.Save(wsz, true);
result := true;
finally
FreeMem(wsz, MAX_PATH * 2);
end;
end;
end;
end;
Ich freue mich über eure Lösungsvorschläge
