Navigation Menu Search PhysiologyWeb
PhysiologyWeb Logo Search PhysiologyWeb
   
— share —
Share on Facebook    Share on X    Share on LinkedIn    Share on Pinterest    Share on Reddit    Email    Copy URL
function CreateInternetShortcut(DestinationFolder, URL, URLShortcutName: String): Boolean;
var
Ini: TIniFile; //uses IniFiles unit
LinkPath: String;
begin
CreateInternetShortcut := False;

LinkPath := '';

LinkPath := DestinationFolder + '\' + URLShortcutName;
LinkPath := ChangeFileExt(LinkPath, '.url');

Ini := TIniFile.Create(LinkPath);
try
Ini.WriteString('InternetShortcut', 'URL', URL);
Ini.UpdateFile;
finally
Ini.Free;
end;

If FileExists(LinkPath) = True then CreateInternetShortcut := True else CreateInternetShortcut := False;
end;

The procedure below uses the function shown above to create the internet shortcut link.

procedure TForm1.Button1(Sender: TObject);
begin
CreateInternetShortcut('C:\PhysiologyWeb', 'https://www.physiologyweb.com/', 'PhysiologyWeb');
end;

Often, it is useful to save the shortcut on the Windows desktop or in some other special folder. To obtain the location of Windows special folders, please see Get the location for Windows special folders (e.g., desktop, start menu, program files, fonts, AppData, etc.).





Posted: Monday, September 4, 2023
Last updated: Tuesday, March 18, 2025
— share —
Share on Facebook    Share on X    Share on LinkedIn    Share on Pinterest    Share on Reddit    Email    Copy URL