i have forgotten how to make a midi
file play continualsly (pardon the spelling)
until a box is checked
CAN ANYONE HELP ME ???
Merlin ?
Printable View
i have forgotten how to make a midi
file play continualsly (pardon the spelling)
until a box is checked
CAN ANYONE HELP ME ???
Merlin ?
Put this code in a module. Also, put a CommandButton and a CheckBox on the Form.
Put these 2 functions in the module.Code: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
Put this in your CommandButtonCode:Public Sub LoadMusic(path As String)
Dim shortPath As String * 128
Dim shortPath2 As String
Dim counter As Integer
Dim chr As String
GetShortPathName path, shortPath, 128
Do Until chr = "."
counter = counter + 1
chr = Mid(shortPath, counter, 1)
Loop
counter = counter + 3
shortPath2 = Mid(shortPath, 1, counter)
mciSendString "open " & shortPath2 & " type sequencer alias background", 0, 0, 0
End Sub
Public Function getMIDIStatus() As Integer
Dim statusString As String * 255
getMIDIStatus = 1
mciSendString "status background mode", ByVal statusString, 255, 0
If Left(statusString, 7) = "playing" Then getMIDIStatus = 0
If Left(statusString, 6) = "paused" Then getMIDIStatus = 0
End Function
Put this in your CheckBoxCode:Private Sub Command1_CLick()
mciSendString "open C:\MyMidi.mid type sequencer alias background", 0, 0, 0
mciSendString "play background", 0, 0, 0
End Sub
[Edited by Megatron on 05-21-2000 at 09:23 AM]Code:Private Sub Check1_Click()
'Stops the music when the box is checked
If Check1.Value = Checked Then
mciSendString "close background", 0, 0, 0
End If
End Sub
thanks that works really well now
thanks again
Merlin ?