VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 添加记录到文档菜单
发表评论(0)作者:, 平台:, 阅读:12609, 日期:2000-03-12
最近用过的文件会自动出现在文档菜单中,只要用很少的代码,在你的程序中也可实现这样的功能:

声明:

Public Const SHARD_PATH = &H2&

Public Declare Function SHAddToRecentDocs Lib "shell32.dll" (ByVal dwFlags As Long, ByVal dwData As String) As Long

函数:

Public Sub AddRecent(strFile As String)

Dim lRetVal As Long

If strFile = "" Then

lRetVal = SHAddToRecentDocs(SHARD_PATH, vbNullString)

Else

lRetVal = SHAddToRecentDocs(SHARD_PATH, strFile)

End If

End Sub

例子:

AddRecent "C:\myfile.txt"

AddRecent "" '清除文档菜单