Ryan's District Boards

Computer, programming, and webmaster help , support , tips and tricks => Internet webmaster computer programming technology tips and tricks => Topic started by: charleychacko on October 15, 2006, 12:15:08 PM

Title: Add documents to "Start | Documents" menu
Post by: charleychacko on October 15, 2006, 12:15:08 PM
By default, Windows will keep track of the documents that you work with and most of the time add them to your "Start | Documents" menu. If you want to add documents to this list from your program (without any user interaction), here's a simple function that can do just that:
uses ShellAPI, ShlOBJ;

procedure AddToStartDocumentsMenu(
  sFilePath : string );
begin
  SHAddToRecentDocs(
    SHARD_PATH,
    PChar( sFilePath ) );
end;


Now, you can just call AddToStartDocumentsMenu() with the document you want to add. For example:

AddToStartDocumentsMenu( 'c:\windows\MyWork.txt' );