====看不懂例程!!

kitegirls 2003-04-17 11:33:11
Private Sub AI_OPEN_Click()
Dim msec As Double


mciWave.UpdateInterval = 0

//为什么要再做一个form来放dlgopenfile?
//FilterIndex是什么意思?
frmOpenDlg.dlgOpenFile.FilterIndex = 1

//flags是什么意思?
frmOpenDlg.dlgOpenFile.Flags = vbOFNReadOnly Or vbOFNFileMustExist
frmOpenDlg.dlgOpenFile.CancelError = True

//这个文件名藏在form里还是dlgopenfile里?
frmOpenDlg.dlgOpenFile.FileName = ""

//resume是什么意思?
On Error Resume Next
frmOpenDlg.dlgOpenFile.ShowOpen

If Err <> 0 Then
Exit Sub
End If


If Not mciWave.Mode = vbMCIModeNotOpen Then
mciWave.Command = "Close"
End If



mciWave.FileName = frmOpenDlg.dlgOpenFile.FileName
//不明白!!!当上面那句错,跳到MCI_ERROR??
On Error GoTo MCI_ERROR
mciWave.Command = "Open"

// 0 在哪里???
On Error GoTo 0
Caption = DialogCaption + mciWave.FileName


//以下均不明白!!!!!!!!!!!!!
mciWave.TimeFormat = vbMCIFormatMilliseconds
lblWave.Caption = "0.0"
msec = (CDbl(mciWave.Length) / 1000)
lblWaveSec.Caption = Format$(msec, "0.00")

' Set the scrollbar values.
hsbWave.value = 0
CurrentValue = 0#
Exit Sub

MCI_ERROR:
DisplayErrorMessageBox
Resume MCI_EXIT

MCI_EXIT:
Unload frmWave

End Sub
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wamlaw 2003-04-17
  • 打赏
  • 举报
回复
UpdateInterval Property (Multimedia MCI Control)

Specifies the number of milliseconds between successive StatusUpdate events.

Syntax

[form.]MMControl.UpdateInterval[ = milliseconds%]

Remarks

The argument milliseconds% specifies the number of milliseconds between events. If milliseconds is 0, no StatusUpdate events occur.

Data Type

Integer


kitegirls 2003-04-17
  • 打赏
  • 举报
回复
remanwang(玩玩儿)

你挺了解我的
我的确什么都不明白
但老师让交作业不做不成
直接copy我又感觉对不起自己
所以,只好麻烦大家了

UpdateInterval什么意思???
remanwang 2003-04-17
  • 打赏
  • 举报
回复
搞了半天什么都不明白
danielinbiti 2003-04-17
  • 打赏
  • 举报
回复
mciWave.TimeFormat = vbMCIFormatMilliseconds
lblWave.Caption = "0.0"
msec = (CDbl(mciWave.Length) / 1000) '计算总共需要多少秒
lblWaveSec.Caption = Format$(msec, "0.00") ' label 中显示。format用法你搜索以前的帖子,格式比较多。
cevitamic 2003-04-17
  • 打赏
  • 举报
回复
1. dlgopenfile是一个CommonDialog控件,放在
2. FilterIndex是所用的文件类型过滤器的序号, 1表示使用默认的过滤器
3. Flags是用来设置对话框选项的,cdlOFNReadOnly是说创建对话框时将只读复选框选中,同时也记录对话框关闭时只读复选框的状态,cdlOFNFileMustExist是说用户只能在文件名框中输入存在的文件的名字,如果输入一个不存在的文件名,将会显示警告提示。这里的文件名也包括路径。
4. 文件名藏在dlgopenfile里
5. On Error Resume Next的作用是当发生一个运行时错误时,继续执行导致错误的那条语句后的语句,或者继续执行最近的一条跳出使用On Error Resume Next的过程的调用语句,这样使得即使发生运行时错误,程序任能继续执行
qbilbo 2003-04-17
  • 打赏
  • 举报
回复
Private Sub AI_OPEN_Click()
Dim msec As Double


mciWave.UpdateInterval = 0

//估计这个过程是在一个模块中,或该过程所在窗体没有Commonialg控件,所以要用frmOpenDlg中的Commondialog控件。
//FilterIndex是设置“打开”或“另存为”对话框中一个缺省的过滤器。


frmOpenDlg.dlgOpenFile.FilterIndex = 1

//flags是为“打开”和“另存为”对话框设置选项
//cdlOFNReadOnly 建立对话框时,只读复选框初始化为选定。该标志也指示对话框关闭时只读复选框的状态。
//cdlOFNPathMustExist 它指定只能输入有效路径。如果设置该标志,输入非法路径时,应显示一个警告信息。
frmOpenDlg.dlgOpenFile.Flags = vbOFNReadOnly Or vbOFNFileMustExist
frmOpenDlg.dlgOpenFile.CancelError = True

//filename是commondialog控件的一个属性
frmOpenDlg.dlgOpenFile.FileName = ""

//如果有错误,则忽略错误,继续下一行。 从frmOpenDlg.dlgOpenFile.ShowOpen这一句开始效
On Error Resume Next
frmOpenDlg.dlgOpenFile.ShowOpen

If Err <> 0 Then
Exit Sub
End If


If Not mciWave.Mode = vbMCIModeNotOpen Then
mciWave.Command = "Close"
End If



mciWave.FileName = frmOpenDlg.dlgOpenFile.FileName
//从mciWave.Command = "Open"开始,有错误跳到MCI_ERROR
On Error GoTo MCI_ERROR
mciWave.Command = "Open"

// On Error GoTo 0 表示取消上面的设置,即有错误不再跳到MCI_ERROR,而是报错。
On Error GoTo 0
Caption = DialogCaption + mciWave.FileName


//没时间了,以下都是控件属性的设置,MSDN上都有。
mciWave.TimeFormat = vbMCIFormatMilliseconds
lblWave.Caption = "0.0"
msec = (CDbl(mciWave.Length) / 1000)
lblWaveSec.Caption = Format$(msec, "0.00")

' Set the scrollbar values.
hsbWave.value = 0
CurrentValue = 0#
Exit Sub

MCI_ERROR:
DisplayErrorMessageBox
Resume MCI_EXIT

MCI_EXIT:
Unload frmWave

End Sub

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧