Add new item to "Documents" menu

Posted in System

Use SHAddToRecentDocs function with full path to the file as second parameter. Don't forget to add SHlObj in uses chapter.

uses
  Shlobj;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    Edit1.Text:=OpenDialog1.FileName;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  SHAddToRecentDocs(SHARD_PATH, PChar(Edit1.Text));
end;