软件报有专门的介绍包括修改时间,调用API合FSO高定的
解决方案 »
- 我想在StatusBar上显示系统时间,一秒一秒地刷新显示,应该怎么做?最好有代码
- 快速排序(有请高手)
- SQL语句错误原因
- 那两个人是谁?
- 控件大侠们请进啊,帮帮小弟!
- 窗体背景图片大小如何同步变化
- 跟踪问题
- 高分易得
- 100分的问题--我怎么才能使midi文件和程序包含在一起,就像picturebox加载图片一样
- 如何制作类似开始按钮的程序?
- 怎么样实现这种功能?看上去是LABEL或text,当选中并单击时出现下拉框,象COMBOBOX。急!!!!!!!!!
- 高分征解:VB中的form不可以设置比显示屏大,如何才能使VB中的form能像Access的form那样可以比显示屏大,因为需要把A4纸的内容在一页内显示,能解决此题者另给69分。
FileDateTime 函数来得知文件创建或最近修改的日期与时间。
Dim MyStamp
MyStamp = FileDateTime("TESTFILE")
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
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 Const FO_DELETE = &H3
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As Long) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh 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 MoveFile Lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long
Private Sub Form_Load()
Dim lngHandle As Long, SHDirOp As SHFILEOPSTRUCT, lngLong As Long
Dim Ft1 As FILETIME, Ft2 As FILETIME, SysTime As SYSTEMTIME
CDBox.DialogTitle = "Choose a file ..."
CDBox.CancelError = True
CDBox.ShowOpen
CreateDirectory "C:\KPD-Team", ByVal &H0
CopyFile CDBox.FileName, "C:\KPD-Team\" + CDBox.FileTitle, 0 MoveFile "C:\KPD-Team\" + CDBox.FileTitle, "C:\KPD-Team\test.kpd" lngHandle = CreateFile("C:\KPD-Team\test.kpd", GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
GetFileTime lngHandle, Ft1, Ft1, Ft2
FileTimeToLocalFileTime Ft2, Ft1
FileTimeToSystemTime Ft1, SysTime
MsgBox "The selected file was created on" + Str$(SysTime.wMonth) + "/" + LTrim(Str$(SysTime.wDay)) + "/" + LTrim(Str$(SysTime.wYear)) CloseHandle lngHandle DeleteFile "C:\KPD-Team\test.kpd"
With SHDirOp
.wFunc = FO_DELETE
.pFrom = "C:\KPD-Team"
End With SHFileOperation SHDirOp
End
End Sub
TMD
非要俺自己回复一下才出来
小分奉上谢谢各位