English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

假設我
C:\test\有好多個檔案
請問
圖片參考:http://tw.yimg.com/i/tw/blog/rte/smiley_4.gif
如何用vb6找出一個星期內有建檔的檔案有幾個呢?
也就是今天往前算六天
3/14至3/20
謝謝

2007-03-20 18:12:59 · 1 個解答 · 發問者 Anonymous in 電腦與網際網路 程式設計

1 個解答

Private Type FS
B As Byte
F As Byte
E As Integer
R As Integer
S As Integer
Z(128) As Byte
End Type
Private Type ST
Y As Integer
M As Integer
W As Integer
D As Integer
H As Integer
F As Integer
S As Integer
L As Integer
End Type

Private Type FT
L As Long
H As Long
End Type
Private Type HF
F As Long
C As FT
L As FT
W As FT
V As Long
H As Long
S As Long
B As Long
M As Long
N As Long
End Type
Private Type TZ
B As Long
N(32) As Integer
D As ST
A As Long
L(32) As Integer
G As ST
I As Long
End Type
Private Declare Sub GetTimeZoneInformation Lib "kernel32" (T As TZ)
Private Declare Function OpenFile& Lib "kernel32" (ByVal S$, R As FS, ByVal W&)
Private Declare Sub GetFileInformationByHandle Lib "kernel32" (ByVal H&, F As HF)
Private Declare Sub CloseHandle Lib "kernel32" (ByVal H&)
Private Declare Sub FileTimeToSystemTime Lib "kernel32" (F As FT, T As ST)
Private Sub GD(ByVal S$, C As Date, A As Date, W As Date)
Dim H&, F As HF, B As FS, T As ST, Z As TZ, I&
H = OpenFile(S, B, 0)
GetFileInformationByHandle H, F
CloseHandle H
GetTimeZoneInformation Z
I = Z.B
FileTimeToSystemTime F.C, T
C = DateSerial(T.Y, T.M, T.D) + TimeSerial(T.H, T.F - I, T.S)
FileTimeToSystemTime F.L, T
A = DateSerial(T.Y, T.M, T.D) + TimeSerial(T.H, T.F - I, T.S)
FileTimeToSystemTime F.W, T
W = DateSerial(T.Y, T.M, T.D) + TimeSerial(T.H, T.F - I, T.S)
End Sub
Private Sub Command1_Click()
Dim S$, F$, C As Date, A As Date, W As Date
S = "C:\Test\"
F = Dir(S)
Do Until F = ""
If F <> "." And F <> ".." Then
GD S & F, C, A, W
If DateDiff("d", C, Date) < 7 Then Print F: Print "建立日期:"; C: Print "存取日期:"; A: Print "修改日期:"; W; Tab(0)
End If
F = Dir
Loop
End Sub

2007-03-21 10:09:46 · answer #1 · answered by W.J.S. 7 · 0 0

fedest.com, questions and answers