If you need pure code.. then this would do.. it is also sure to work on any PC (even without the Media Player Component).. no extra controls to be included
Code:
'API Declarations
Public 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
Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" ( _
ByVal lpszLongPath As String, ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Private Sub StartMIDI()
midiPath = Space$(128)
GetShortPathName App.Path & "\song.mid", midiPath, 128
'to play
J = InStr(midiPath, Chr$(0))
If J > 0 Then midiPath = Left$(midiPath, J - 1)
mciSendString "open " & LCase$(midiPath) & " alias myfile type sequencer", 0, 0, 0
mciSendString "play myfile", 0, 0, 0
End Sub
Privats Sub StopMIDI()
mciSendString "stop myfile", 0, 0, 0
mciSendString "close myfile", 0, 0, 0
End Sub
---
'Code improved by vBulletin Tool
Thanksforreading:)