Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString _
As String, ByVal _ uReturnLengthAs Integer, ByVal hWndCallback _
As Integer) As Long
Public Sub PlayMid(sFilename As String)
' Spela upp en MID fil
' Exempel: PlayMid "C:\MIDFILES\MYSONG.MID"
Dim ReturnString As String * 128
ReturnString = Space(128)
For I% = 1 To 3
Select Case I%
Case 1
CommandString = "close mymid"
Case 2
CommandString = "open " & sFilename & _
" type sequencer alias mymid"
Case 3
CommandString = "play mymid from 1"
End Select
a& = mciSendString _
(CommandString, ReturnString, Len(ReturnString), 0)
Next I%
End Sub
' Du måste givetvis stanna MID filen sedan
Public Sub StopMid()
'
' Stannar och stänger "mymid" ,
' endast vid användning av PlayMid()
'
' Exempel: Sub cmdStop_Click()
' StopMid
' End Sub
Dim ReturnString As String * 128
ReturnString = Space(128)
CommandString = "close mymid"
a& = mciSendString _
(CommandString, ReturnString, Len(ReturnString), 0)
End Sub