Postup:
Do deklaraΦnφ Φßsti formulß°e zapiÜte:
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
Private Sub StopMIDI(MidiFileName As String)
Call mciSendString("stop " + MidiFileName, 0&, 0, 0)
Call mciSendString("close " + MidiFileName, 0&, 0, 0)
End Sub
Private Function PlayMIDI(MidiFileName As String)
On Error Resume Next
Call mciSendString("open " + MidiFileName + " type sequencer", 0&, 0, 0)
If mciSendString("play " + MidiFileName + Flags, 0&, 0, 0) = 0 Then
PlayMIDI = 0
Else
PlayMIDI = 1
End If
End Function
Na formulß° p°idejte dv∞ tlaΦφtka. Prvnφ z nich spustφ p°ehrßvßnφ,
druh² je ukonΦφ. Na jejich udßlost Click:
Private Sub Command1_Click()
PlayMIDI ("c:\winnt\media\canyon.mid")
End Sub
Private Sub Command2_Click()
StopMIDI ("c:\winnt\media\canyon.mid")
End Sub
|