807
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
Dim Pic As Picture
Set Pic = LoadPicture(App.Path & "\正常图片.jpg")
Picture1.Picture = Pic
End Sub
Private Sub Command2_Click()
Dim Pic As Picture
On Error Resume Next
Set Pic = LoadPicture(App.Path & "\有问题的图片.jpg")
Picture1.Picture = Pic
End Sub
Private Sub Command3_Click()
MsgBox PicEffective(App.Path & "\有问题的图片.jpg")
End Sub
Private Function PicEffective(FileName As String) As Boolean
Dim Pic As StdPicture
On Error GoTo er
PicEffective = True
Set Pic = LoadPicture(FileName)
Set Pic = Nothing
Exit Function
er:
PicEffective = False
End Function

Private Sub Command1_Click()'找出文件夹内文件最新的更新时间(包括里面的子文件夹的文件哈) 要把这个文件夹内的所有文件的最后修改时间都要检查一次,并取出近的一个时间,(主要是检查这个文件夹里面的内容有没有更新),并取出这个文件最后一次的更新时间.环境是VB6
Dim after As Double
Dim f As Integer
Dim dn As String
Dim fn As String
Dim ft As String
Dim ft_date As Date
Command1.Enabled = False
On Error GoTo ERR0
Kill "c:\files.txt"
dn = "c:\windows"
On Error GoTo ERR1
Shell ("cmd /c dir " & dn & "\*.* /a-d /b /s /o-d >c:\files.txt")
after = Now + 60# / 3600# / 24#
f = FreeFile()
Do
REOPEN1:
DoEvents
If Now > after Then
MsgBox "Wait c:\files.txt 60s overtime!"
Exit Sub
End If
Open "c:\files.txt" For Input Lock Read Write As #f
Line Input #f, fn
Close #f
Exit Do
Loop
On Error GoTo ERR0
Kill "c:\files.txt"
On Error GoTo ERR2
Shell ("cmd /c dir " & Chr(34) & fn & Chr(34) & ">c:\files.txt")
after = Now + 60# / 3600# / 24#
f = FreeFile()
Do
REOPEN2:
DoEvents
If Now > after Then
MsgBox "Wait c:\files.txt 60s overtime!"
Exit Sub
End If
Open "c:\files.txt" For Input Lock Read Write As #f
Line Input #f, ft
Line Input #f, ft
Line Input #f, ft
Line Input #f, ft
Line Input #f, ft
Line Input #f, ft
Close #f
Kill "c:\files.txt"
Exit Do
Loop
ft = Left(ft, 17)
ft_date=CDate(ft)
MsgBox "The newest file in [" & dn & "] is [" & fn & "], datetime is [" & ft_date & "]"
Command1.Enabled = True
Exit Sub
ERR0:
Resume Next
ERR1:
Resume REOPEN1
ERR2:
Resume REOPEN2
End Sub