mcisendstring 的问题

jb54jb 2007-11-20 10:37:29
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrRetumString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

谁有 详细的lpstrCommand 的用法
还有 lpstrRetumString/ uReturnLength /hwndCallback 的用法
...全文
82 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yefm 2007-11-21
  • 打赏
  • 举报
回复
【VB声明】
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

【别名】
mciSendStringA

'This project needs a Common Dialog box, named 'CDBox'
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim Alias As String
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Const PlayTime = 10
'Set the common dialog box' title
CDBox.DialogTitle = "Choose your midi-file"
'Set the filter
CDBox.Filter = "Midi-files (*.mid)|*.mid"
'Show the 'Open File'-dialog
CDBox.ShowOpen
'Extract an alias from the file
Alias = Left$(CDBox.FileTitle, Len(CDBox.FileTitle) - 4)

'play midi
R% = mciSendString("OPEN " + CDBox.filename + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString("PLAY " + Alias + " FROM 0", 0&, 0, 0)
R% = mciSendString("CLOSE ANIMATION", 0&, 0, 0)

'play midi for 10 secs
t = Timer
Do: DoEvents: Loop Until Timer > t + PlayTime

'stop midi and close it
R% = mciSendString("OPEN " + CDBox.filename + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString&("STOP " + Alias, 0&, 0, 0)
R% = mciSendString&("CLOSE ANIMATION", 0&, 0, 0)
End Sub
tianhuo_soft 2007-11-21
  • 打赏
  • 举报
回复
MCI Command String是多媒体设备的程序接口。通过它,我们可以打开一个多媒体文件,例如mp3,VCD文件,Mpeg4格式的文件等等,并对它进行播放,暂停,关闭等操作。现在小弟有幸给大家介绍一下MCI Command String的使用方法。

MCI Command String是通过mciExecute或mciSendString两个函数执行的。这两个函数的声明如下:

Private Declare Function mciExecute Lib "winmm.dll" Alias "mciExecute" (ByVal lpstrCommand As String) As Long

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

这两个函数都有一个叫lpstrCommand的参数, 这个参数就是我们今天要介绍的MCI Command String。其中函数mciSendString还有三个参数,lpstrReturnString是一个字符串,它用来接收mciSendString函数返回的信息(例如,我们在lpstrCommand中的命令是让函数返回打开的文件的设备类型,那么函数就把设备类型的信息保存在这个参数中。);uReturnLength参数用来指定参数lpstrReturnString的长度;hwndCallback

jb54jb 2007-11-21
  • 打赏
  • 举报
回复
对不起 E文我看不懂 有中文版的没啊? 或许给翻译成中文的成么?
jacksoft 2007-11-21
  • 打赏
  • 举报
回复
http://msdn2.microsoft.com/en-us/library/ms709492.aspx
:P

1,486

社区成员

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

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