SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Create shortcut

This example shows, how to create your own link to Notepad.
This link will have a 'MyNotePad.lnk' name and 'c:\MyNotePad.lnk' path.
Use IShellLink interface and SetArgument, SetDescription and SetPath functions of this interface to set options of this link.

procedure CreateLink(const PathObj, PathLink, Desc, Param: string);
var
  IObject: IUnknown;
  SLink: IShellLink;
  PFile: IPersistFile;
begin
  IObject:=CreateComObject(CLSID_ShellLink);
  SLink:=IObject as IShellLink;
  PFile:=IObject as IPersistFile;
  with SLink do
  begin
    SetArguments(PChar(Param));
    SetDescription(PChar(Desc));
    SetPath(PChar(PathObj));
  end;
  PFile.Save(PWChar(WideString(PathLink)), FALSE);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  CreateLink('c:\windows\notepad.exe','c:\MyNotePad.lnk','','');
end;
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes