Mega Code Archive

 
Categories / Delphi / Examples
 

Add documents to start documents menu

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' );