Wednesday, March 2, 2011

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

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum