
function GetLnkName(Key, ProgramName: string): string;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', true);
Result := reg.ReadString(Key);
if Result <> '' then Result := Result + '\';
Result := Result + ChangeFileExt(ExtractFileName(ProgramName), '.lnk');
reg.free;
end;
procedure SaveLink(Key, ProgramName, ProgramPath: string; Arguments: string; Description: string; IconLocation: integer);
var
AnObj: IUnknown;
ShLink: IShellLink;
PFile: IPersistFile;
FullName: string;
WideName: WideString;
begin
FullName := GetLnkName(Key, ProgramName);
if not FileExists(FullName) then
begin
AnObj := CreateComObject(CLSID_ShellLink);
ShLink := AnObj as IShellLink;
PFile := AnObj as IPersistFile;
ShLink.SetPath(PChar(ProgramPath));
ShLink.SetArguments(PChar(Arguments));
ShLink.SetIconLocation(PChar(ProgramPath), IconLocation);
ShLink.SetWorkingDirectory(PChar(ExtractFilePath(ProgramPath)));
ShLink.SetDescription(PChar(Description));
WideName := FullName;
PFile.Save(PWChar(WideName), False);
ShLink := nil;
PFile := nil;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
SaveLink('Desktop', ExtractFileName(ParamStr(0)), ParamStr(0), '', '', 0);
end;
Seřadit Ikony ->
Aktualizovat
-----------------
Vložit
Vložit zástupce
-----------------
[b]a sem bych chtěl vložit odkaz na můj program[/b]
-----------------
Nový ->
-----------------
Vlastnosti
-------------------- 
Užívatelia prezerajúci si toto fórum: Žiadny registrovaný používateľ a 1 hosť.