Option Explicit
Private 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
Private Sub cmdAdd_Click()
If (txtFile.Text <> "") Then AddRecent (txtFile.Text)
End Sub
Private Sub cmdBrowse_Click()
dlgFile.ShowOpen
txtFile.Text = dlgFile.FileName
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub txtFile_Change()
If (txtFile.Text <> "") Then
cmdAdd.Enabled = True
Else
cmdAdd.Enabled = False
End If
End Sub
==============================================
运行的结果是SHARD_PATH变量没有定义
我不知道应该定义SHARD_PATH为多少
const SHARD_PATH=?
查MSDN没有查到,哪个高人指点一下?
const SHARD_PATHA = &h00000002&
用vc查找。。。