SHAddToRecentDocs Function

Declare Sub SHAddToRecentDocs Lib "shell32.dll" (ByVal uFlags As Long, ByVal pv As Any)

Platforms

Description & Usage

SHAddToRecentDocs adds a shortcut to a file to the shell's Documents menu under the Start menu. To accomplish this, the function creates a shortcut to the file under the Recent directory (the folder identified by the CSIDL CSIDL_RECENT). Instead of adding a file to the Documents menu, this function can also clear the entire contents of the Documents menu.

Return Value

SHAddToRecentDocs does not return a value.

Visual Basic-Specific Issues

When passing 0 for the pv parameter, you must use the expression CLng(0) to pass it correctly.

Parameters

uFlags
Either one of the following flags specifying the nature of the pv parameter, or 0 to clear the contents of the Documents menu.
SHARD_PIDL
pv is a pointer to an ITEMIDLIST structure (a PIDL) identifying the file to add to the Documents menu.
SHARD_PATH
pv is the filename of the file to add to the Documents menu.
pvIdentifies the file to add to the Documents menu. It is either a PIDL or a string, depending on the value passed as uFlags. If uFlags is 0, this must also be 0.

Constant Definitions

Const SHARD_PIDL = 1
Const SHARD_PATH = 2

Example

' This code is licensed according to the terms and conditions listed here.

' First, clear the Documents menu.  Then add a link to the file
' C:\MyDocs\report.txt to the Documents menu.  Of course, you
' should always ask the user before you clear the Documents menu!

' Clear the Documents menu entirely.
SHAddToRecentDocs 0, CLng(0)

' Then add the file C:\MyDocs\report.txt to the menu.
SHAddToRecentDocs SHARD_PATH, "C:\MyDocs\report.txt"

Category

Shell

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: December 28, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/shaddtorecentdocs.html