How to Add Files to the Start|Documents Menu

Windows keeps track of the files you work with ands them to the Start|Documents menu. If you want to add documents to this menu from your program, just use the SHAddToRecentDocs() function. The function requires a PChar parameter but so you can use aways either typecast strings to PChars or use the StrPCopy() function.

uses ShlObj;
...
  { sFileName - the full name of the file you want to add }
  SHAddToRecentDocs(SHARD_PATH, PChar(sFileName));
...

Examples:

  SHAddToRecentDocs(SHARD_PATH, 'C:\\My Documents\\Notes.txt');
  SHAddToRecentDocs(SHARD_PATH, dlgOpen.FileName);

Tags: , , , , , , , , , , ,

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login