试着在下面这段代码加个时间记录,看看用了多少时间
dtBefor=now
If Int(FsoX.GetFile(CommonDialog1.Filename).Size / 1024) + 1 > 600 Then
Set FsoX = Nothing
Msgbox "請導入圖像大小小於600K的圖像!"
Exit Sub
End If
dtAfter=now
dtResult=dtBefor - dtAfter
下面這段程序會有問題嗎?===============程序常死啊.或資源不足...
Private Sub Command10_Click()
On Error GoTo ErrX:
Dim FsoX As FileSystemObject
If Trim(Text1(1).Text) = "" Then
Set FsoX = Nothing
Msgbox "請先輸入圖像編號!"
Text1(1).SetFocus
Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
Set FsoX = Nothing
Msgbox "請先輸入圖像大類!"
Text1(2).SetFocus
Exit Sub
End If
CommonDialog1.Flags = &H4&
CommonDialog1.ShowOpen
If Trim(CommonDialog1.Filename) = "" Then
GoTo ErrX
End If
If Int(FsoX.GetFile(CommonDialog1.Filename).Size / 1024) + 1 > 600 Then
Set FsoX = Nothing
Msgbox "請導入圖像大小小於600K的圖像!"
Exit Sub
End If
If SSTab1.Tab = 0 Then
Set Picture5(0).Picture = Nothing
Picture5(0).Picture=Loadpicture(CommonDialog1.Filename)
TextA1(0).Text = UCase(CommonDialog1.Filename)
End If
Set FsoX = Nothing
Exit Sub
ErrX:
Set FsoX = Nothing
If Err.Number = cdlCancel Then
Exit Sub
Else
Msgbox "導入圖像失敗!"
End If
End Sub