急切求救!

Flier 2000-06-23 11:30:00
小弟乃一编程新手,现有一VB程序急待完成,但苦于有些功能难以实现,急切求救:
1 MCI指令串中,不能正确识别带空格的文件名,如何解决?
2 是否有能返回.MID, .avi, .mpg, .dat文件总的播放时间及当前位置的MCI指令?若没有,在VB中是否有其他方法完成这些功能?
3 可用来调节系统音量的API函数是什么?VB中如何声明?各参数的含义是什么?
叩请赐教,感激涕零!
...全文
138 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Chen_Lin 2000-06-24
  • 打赏
  • 举报
回复
1)加引号,例如:
If InStr(sTheFile, " ") Then sTheFile = Chr(34) & sTheFile & Chr(34)
nReturn = mciSendString("Open " & sTheFile & " ALIAS " & sAlias _
& " TYPE " & sType & " wait", "", 0, 0)
2)
'得到当前播放文件总共播放时间长度
Property Get Length() As Single
' Routine to return the length of the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString
Dim nReturn As Long, nLength As Integer

' Declare a string to hold the returned length from the mci Status call
Dim sLength As String * 255

' If there is no file open then return 0
If sAlias = "" Then
Length = 0
Exit Property
End If
'sAlias是文件的别名,自己随便定义
nReturn = mciSendString("Status " & sAlias & " length", sLength, 255, 0)
nLength = InStr(sLength, Chr$(0))
Length = Val(Left$(sLength, nLength - 1))
End Property
'得到当前位置
Property Get Status() As String
' Returns the playback/record status of the current file

' Declare a variable to hold the return value from mciSendString
Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the return string from mciSendString
Dim sStatus As String * 255

' If there is no file currently opened, then exit the subroutine
If sAlias = "" Then Exit Property

nReturn = mciSendString("Status " & sAlias & " mode", sStatus, 255, 0)

nLength = InStr(sStatus, Chr$(0))
Status = Left$(sStatus, nLength - 1)

End Property
3)
http://www.csdn.net/visual%20basic/index.htm
audio.zip 4K 改变计算机的音量

7,759

社区成员

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

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