modrecentlist.bas
来自「WinBig. A file archive utility written i」· BAS 代码 · 共 42 行
BAS
42 行
Attribute VB_Name = "ModRecentList"
Option Explicit
Public Const ThisKey = "Recent Files"
Sub GetRecentFiles(frm As Form)
Dim i As Integer
Dim varFiles As Variant
If GetSetting(App.EXEName, ThisKey, "RecentFile1") = Empty Then Exit Sub
varFiles = GetAllSettings(App.EXEName, ThisKey)
For i = 0 To UBound(varFiles, 1)
frm.mnuRecentFile(0).Visible = True
frm.mnuRecentFile(i + 1).Caption = "&" & (i + 1) & " " & varFiles(i, 1)
frm.mnuRecentFile(i + 1).Visible = True
Next i
End Sub
Sub WriteRecentFiles(frm As Form, OpenFileName)
Dim i As Integer
Dim strFile As String, strKey As String, strShort As String
For i = 1 To 4
If LCase(Mid(frm.mnuRecentFile(i).Caption, 4)) = LCase(OpenFileName) Then
Exit Sub
End If
Next i
For i = 3 To 1 Step -1
strKey = "RecentFile" & i
strFile = GetSetting(App.EXEName, ThisKey, strKey)
If strFile <> "" Then
strKey = "RecentFile" & (i + 1)
SaveSetting App.EXEName, ThisKey, strKey, strFile
End If
Next i
SaveSetting App.EXEName, ThisKey, "RecentFile1", UCase(OpenFileName)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?