正文

如何用API播放CD2006-02-15 22:06:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/stef/10146.html

分享到:

Declare Function mciSendString& Lib "MMSYSTEM" (ByVal lpstrCommand$, ByVal lpstrReturnStr As Any, ByVal wReturnLen%, ByVal hCallBack%)'Add the code below to appropriate routinesSub cmdPlay_Click ()Dim lRet As LongDim nCurrentTrack As Integer'Open the devicelRet = mciSendString("open cdaudio alias cd wait", 0&, 0, 0)'Set the time format to Tracks (default is milliseconds)lRet = mciSendString("set cd time format tmsf", 0&, 0, 0)'Then to play from the beginninglRet = mciSendString("play cd", 0&, 0, 0)'Or to play from a specific track, say track 4nCurrentTrack = 4lRet = mciSendString("play cd from" & Str(nCurrentTrack), 0&, 0, 0)End Sub' Remember to Close the device when ending playbackSub cmdStop_Click ()Dim lRet As Long'Stop the playbacklRet = mciSendString("stop cd wait", 0&, 0, 0)DoEvents 'Let Windows process the event'Close the devicelRet = mciSendString("close cd", 0&, 0, 0)End Sub---------------------------------------------------

阅读(2311) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册