- ©«¤l
- 96
- ¥DÃD
- 18
- ºëµØ
- 0
- ¿n¤À
- 125
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-3-23
- ³Ì«áµn¿ý
- 2022-8-2
|
¦^´_ 1# smart3135
«á¨Óª¦¤å¦³§ä¨ì³oÓ¡A¥i¥H§å¦¸ÅܧóÀɮ׳̫áקï®É¶¡
¤£¹L·|³s«Ø¥ß®É¶¡»P¦s¨ú®É¶¡¤@°_Åܧó
¤£ª¾¹D¯à¤£¯à³æ¯Â¥uÅܧóÀɮ׳̫áקï®É¶¡¡A¥t¥~¨âӮɶ¡¤£¥h°Ê¨ì- 'Àɮ׮ɶ¡Åª¨ú¡B³]©wªº API ¤Î±`¼Æ«Å§i
- Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
- Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FileTime, lpLastAccessTime As FileTime, lpLastWriteTime As FileTime) As Long
- Private Declare Function SetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FileTime, lpLastAccessTime As FileTime, lpLastWriteTime As FileTime) As Long
- Private Declare Function SystemTimeToFileTime Lib "kernel32" (lpSystemTime As SYSTEMTIME, lpFileTime As FileTime) As Long
- Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FileTime, lpSystemTime As SYSTEMTIME) As Long
- Private Declare Function LocalFileTimeToFileTime Lib "kernel32" (lpLocalFileTime As FileTime, lpFileTime As FileTime) As Long
- Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
- Private Const GENERIC_WRITE = &H40000000
- Private Const OPEN_EXISTING = 3
- Private Const FILE_SHARE_READ = &H1
- Private Const FILE_SHARE_WRITE = &H2
- Private Type SYSTEMTIME
- wYear As Integer
- wMonth As Integer
- wDayOfWeek As Integer
- wDay As Integer
- wHour As Integer
- wMinute As Integer
- wSecond As Integer
- wMilliseconds As Integer
- End Type
- Private Type FileTime
- dwLowDateTime As Long
- dwHighDateTime As Long
- End Type
- '¨ú±oÀɮ׮ɶ¡
- Private Function GetTime(f As String, t1 As FileTime, t2 As FileTime, t3 As FileTime)
- lngHandle = CreateFile(f, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
- GetFileTime lngHandle, t1, t1, t2
- CloseHandle lngHandle
- End Function
- '³]©wÀɮ׮ɶ¡
- Private Function SetTime(f As String, t1 As FileTime, t2 As FileTime, t3 As FileTime)
- lngHandle = CreateFile(f, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
- SetFileTime lngHandle, t1, t1, t2
- CloseHandle lngHandle
- End Function
- Private Sub Command1_Click()
- Dim ÀɦW As String
- Dim ·s¤é´Á®É¶¡ As Date
- Dim Àɮ׫إ߮ɶ¡ As FileTime
- Dim ³Ì«áŪ¨ú®É¶¡ As FileTime
- Dim ³Ì«áקï®É¶¡ As FileTime
- Dim tmp As SYSTEMTIME
-
- ·s¤é´Á®É¶¡ = Now '<-----------¹w³]Àɮ׮ɶ¡¬°·í¤U
- ¸ô®| = "d:\tmp\" '<-----------ÀɮשҦbªº¸ê®Æ§¨
- ÀÉ®×Ãþ«¬ = "*.*" '<-----------¿ï¨úªºÀÉ®×Ãþ«¬
-
- tmp.wYear = Year(·s¤é´Á®É¶¡)
- tmp.wMonth = Month(·s¤é´Á®É¶¡)
- tmp.wDay = Day(·s¤é´Á®É¶¡)
- tmp.wHour = Hour(·s¤é´Á®É¶¡)
- tmp.wMinute = Minute(·s¤é´Á®É¶¡)
- tmp.wSecond = Second(·s¤é´Á®É¶¡)
- tmp.wMilliseconds = 0
-
- SystemTimeToFileTime tmp, Àɮ׫إ߮ɶ¡
- LocalFileTimeToFileTime Àɮ׫إ߮ɶ¡, Àɮ׫إ߮ɶ¡
-
- ³Ì«áŪ¨ú®É¶¡ = Àɮ׫إ߮ɶ¡ '<-----------§â¤TӮɶ¡³£³]¦¨¤@P
- ³Ì«áקï®É¶¡ = Àɮ׫إ߮ɶ¡
-
- SetTime ÀɦW, Àɮ׫إ߮ɶ¡, ³Ì«áŪ¨ú®É¶¡, ³Ì«áקï®É¶¡
-
- '¶i¦æ§ó§ï
- ÀɦW = Dir(¸ô®| & ÀÉ®×Ãþ«¬, vbNormal Or vbArchive Or vbReadOnly)
- Do While ÀɦW <> ""
- SetTime ¸ô®| & ÀɦW, Àɮ׫إ߮ɶ¡, ³Ì«áŪ¨ú®É¶¡, ³Ì«áקï®É¶¡
- ÀɦW = Dir
- Loop
-
- End Sub
½Æ»s¥N½X |
|