📄 frmmain.frm
字号:
VERSION 5.00
Begin VB.Form frmMain
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Caption = "File Times"
ClientHeight = 3495
ClientLeft = 4470
ClientTop = 4365
ClientWidth = 5550
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3495
ScaleWidth = 5550
Begin VB.Frame Frame2
Height = 1335
Left = 120
TabIndex = 13
Top = 0
Width = 5295
Begin VB.CommandButton cmdGet
Caption = "Get File Values"
Height = 375
Left = 3720
TabIndex = 1
Top = 840
Width = 1455
End
Begin VB.TextBox txtFile
Height = 285
Left = 120
TabIndex = 0
Top = 480
Width = 5055
End
Begin VB.Label Label4
Caption = "File Path:"
Height = 255
Left = 120
TabIndex = 14
Top = 240
Width = 1815
End
End
Begin VB.Frame Frame1
Height = 2055
Left = 120
TabIndex = 9
Top = 1320
Width = 5295
Begin VB.TextBox txtCreate
Height = 285
Left = 1920
TabIndex = 2
Top = 240
Width = 2295
End
Begin VB.TextBox txtAccess
Height = 285
Left = 1920
TabIndex = 3
Top = 720
Width = 2295
End
Begin VB.TextBox txtModify
Height = 285
Left = 1920
TabIndex = 4
Top = 1200
Width = 2295
End
Begin VB.CommandButton cmdSet
Caption = "Set All Values"
Height = 375
Left = 3720
TabIndex = 8
Top = 1560
Width = 1455
End
Begin VB.CommandButton cmdSetCreate
Caption = "Set"
Height = 255
Left = 4440
TabIndex = 5
Top = 240
Width = 735
End
Begin VB.CommandButton cmdSetAccess
Caption = "Set"
Height = 255
Left = 4440
TabIndex = 6
Top = 720
Width = 735
End
Begin VB.CommandButton cmdModify
Caption = "Set"
Height = 255
Left = 4440
TabIndex = 7
Top = 1200
Width = 735
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "Creation Date:"
Height = 255
Left = 240
TabIndex = 12
Top = 240
Width = 1575
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Modified Date:"
Height = 255
Left = 240
TabIndex = 11
Top = 1200
Width = 1575
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "Last Accessed Date:"
Height = 255
Left = 240
TabIndex = 10
Top = 720
Width = 1575
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mstrFile As String
Private Sub cmdGet_Click()
Dim dteCreate As Date
Dim dteAccess As Date
Dim dteModify As Date
If Trim$(mstrFile) = "" Then
Call MsgBox("Enter a file path.", vbCritical, "No File Specified")
Exit Sub
End If
If Not GetFileTimes(mstrFile, dteCreate, dteAccess, dteModify, True) Then
Call MsgBox("Error getting file dates.", vbCritical, "Unable to Read File Dates")
Exit Sub
End If
txtCreate.Text = CStr(dteCreate)
txtAccess.Text = CStr(dteAccess)
txtModify.Text = CStr(dteModify)
End Sub
Private Sub cmdModify_Click()
Dim dteDate As Date
If Trim$(mstrFile) = "" Then
Call MsgBox("Enter a file path.", vbCritical, "No File Specified")
Exit Sub
End If
dteDate = CDate(txtModify.Text)
If Not SetFileModifiedDate(mstrFile, dteDate, True) Then
Call MsgBox("Error setting file modified date.", vbCritical, "Unable to Touch File")
End If
End Sub
Private Sub cmdSet_Click()
Dim dteCreate As Date
Dim dteAccess As Date
Dim dteModify As Date
If Trim$(mstrFile) = "" Then
Call MsgBox("Enter a file path.", vbCritical, "No File Specified")
Exit Sub
End If
dteCreate = CDate(txtCreate.Text)
dteAccess = CDate(txtAccess.Text)
dteModify = CDate(txtModify.Text)
If Not SetFileTimes(mstrFile, dteCreate, dteAccess, dteModify, True) Then
Call MsgBox("Error setting file dates.", vbCritical, "Unable to Touch File")
End If
End Sub
Private Sub cmdSetAccess_Click()
Dim dteDate As Date
If Trim$(mstrFile) = "" Then
Call MsgBox("Enter a file path.", vbCritical, "No File Specified")
Exit Sub
End If
dteDate = CDate(txtAccess.Text)
If Not SetFileAccessedDate(mstrFile, dteDate, True) Then
Call MsgBox("Error setting file last accessed date.", vbCritical, "Unable to Touch File")
End If
End Sub
Private Sub cmdSetCreate_Click()
Dim dteDate As Date
If Trim$(mstrFile) = "" Then
Call MsgBox("Enter a file path.", vbCritical, "No File Specified")
Exit Sub
End If
dteDate = CDate(txtCreate.Text)
If Not SetFileCreatedDate(mstrFile, dteDate, True) Then
Call MsgBox("Error setting file creation date.", vbCritical, "Unable to Touch File")
End If
End Sub
Private Sub txtFile_Change()
mstrFile = txtFile.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -