就是一个文件的修改时间是WINDOWS自己定的(系统时间),现在我要把某个文件的修改时间任意改动怎么做,比如一个文件是刚键好的,我要把它改为去年的某个时间。
解决方案 »
- vb from子语句错误
- 不同的结构体如果放到一个数组中,然后循环区出来?
- 请教:VB用EXCEL打印的时候如何先显示一下"打印设置",然后再按照打印设置里的选项进行打印呢?
- 请教斑竹:怎样才能增及信誉分
- 严重讨论:【目前比较流行的软件哪些是用VB写的?】
- 急,如何向data追加数据啊?
- vb6我在向窗体中添加DBGrid时出现:"该部件的许可证信息没有找到.在设计环境中,没有合适的许可证使用该功能"错误,是怎么回事?
- 高数问题
- 我是小生,网打下能帮一下我
- msado15.dll不能注册的问题
- 程序中访问EXCEL工作表,如果它有密码,可不可以打开呢?
- 怎样让程序运行以后用户可以调整listbox框的大小啊?
SetAttr "d:\g.exe", vbNormal
就可以将G.exe设为默认属性,然后再用FSO
他什么都能改
最好把文件复制到软盘上改,因为他不认识FAT32
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
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 Const GENERIC_WRITE = &H40000000
Private Const OPEN_EXISTING = 3
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
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 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 CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function LocalFileTimeToFileTime Lib "kernel32" (lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As LongPrivate Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
Dim m_Date As Date, lngHandle As Long
Dim udtFileTime As FILETIME
Dim udtLocalTime As FILETIME
Dim udtSystemTime As SYSTEMTIME
m_Date = Format(Now, "DD-MM-YY") 'Set the dialog's title
cdbox.DialogTitle = "Choose a file ..."
'Set the dialog's filter
cdbox.Filter = "All Files (*.*)|*.*"
'Show the 'Open File'-dialog
cdbox.ShowOpen udtSystemTime.wYear = Year(m_Date)
udtSystemTime.wMonth = Month(m_Date)
udtSystemTime.wDay = Day(m_Date)
udtSystemTime.wDayOfWeek = Weekday(m_Date) - 1
udtSystemTime.wHour = Hour(m_Date)
udtSystemTime.wMinute = Minute(m_Date)
udtSystemTime.wSecond = Second(m_Date)
udtSystemTime.wMilliseconds = 0 ' convert system time to local time
SystemTimeToFileTime udtSystemTime, udtLocalTime
' convert local time to GMT
LocalFileTimeToFileTime udtLocalTime, udtFileTime
' open the file to get the filehandle
lngHandle = CreateFile(cdbox.FileName, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
' change date/time property of the file
SetFileTime lngHandle, udtFileTime, udtFileTime, udtFileTime
' close the handle
CloseHandle lngHandle
MsgBox "The date of the file '" + cdbox.FileName + "' has been changed to" + Str$(m_Date), vbInformation + vbOKOnly, App.Title
End Sub