Game Development Reference
In-Depth Information
shortcut to the file and place it in the Recent Documents folder. The following
code shows how to do this.
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PATHW),
path);
Clearing the Recent Documents folder is even easier! Passing a null PIDL pointer
into the method will clear all the entries. The following code shows how to do this.
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PIDL)
IntPtr.Zero);
Note
The SHAddToRecentDocs method does not check if the files passed to it are valid, so it is the
responsibility of your application to pass qualified file paths.
Example Usage
Using the code is extremely straightforward. The following example clears all cur-
rent entries in the Recent Documents menu, and then adds four new entries to it.
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PIDL),
IntPtr.Zero);
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PATHW),
@”C:\MyFolder\File1.txt”);
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PATHW),
@”C:\MyOtherFolder\File2.doc”);
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PATHW),
@”C:\Images\File3.gif”);
SHAddToRecentDocs(Convert.ToUInt32(PointerType.SHARD_PATHW),
@”C:\MyFolder\File4.zip”);
Conclusion
Managing items in the recent documents folder is extremely trivial, but do not
underestimate the significance of implementing features like this. Users expect all
applications to function the same way; if they don't, you end up breaking interface
transparency, and users will hate your program because of it.
 
Search Nedrilad ::




Custom Search