请使用MCI的API "mciSendCommand"
例子我相信你应该找的到,太多了。
例子我相信你应该找的到,太多了。
解决方案 »
- vb sendkeys是不是只能用一次剪切板啊?
- 我在用VB操作WORD里遇到一个奇怪现象.真不知道要怎么解决!
- 急求免费的TTS(Text To Speech)语音控件
- 可不可以动态创建一个MDI子窗体啊?
- 小弟初来,有简单问题请教各位!谢谢!
- 请如何使用WININET(api)或Internet Transfer(控件)
- 如何写入注册表二进值(binary)的一个特例!
- 名师救我....
- 如何定时重启应用程序?
- 请问如何把一个文本文件(如1.txt)的内容赋给 label控件?
- 这样构造数据库正不正确,如何解决以下问题
- 一直不想用外部控件,可是现在我没办法了,listview无法用API实现..
' (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: [email protected]
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