How to play songs while program’s exe (written in VB 6) runs.

155 pts.
Tags:
VB
Visual Basic
Visual Basic 6
Windows Media Player
Please show me the code to -- play songs, through Windows Media Player 9, while my program's exe (written in VB 6) runs. What I have tried is, In a form I have taken 1) 'Windows Media Player' control ('wmp.dll') from 'Project' Menu --> 'Components'. 2) 'FileListBox' control, which contains file names of songs as a list (By setting 'path' & 'pattern' properties. The code of the form is as below. But it plays only first song and none of the others. If I put a breakpoint at a line shown below, it starts playing next song and plays it till the execution is paused due to breakpoint, as soon as I start paused execution by pressing 'F5', it stops playing. Please help me to solve this problem. Thanks in Advance. ------------------------------------------------------------------------------ Dim FlNms() As String 'name of the song file. Dim FlCnt As Double 'to count total number of files. Dim CrntFlNm As Double 'the number of the file to play next. Dim PList As WMPPlaylistCtrl ------------------------------------------------------------------------------ Public Sub Form_Load() Dim i As Integer fl.Path = App.Path & "Data" fl.Pattern = "*.mp3;*.wav" FlCnt = fl.ListCount ReDim FlNms(FlCnt) For i = 0 To FlCnt - 1 FlNms(i) = fl.List(i) Next CrntFlNm = 0 Me.Left = 0 Me.Top = 0 Call PlaySong End Sub ------------------------------------------------------------------------------ Private Sub MP1_PlayStateChange(ByVal NewState As Long) If NewState = 8 Then Call PlaySong End If End Sub ------------------------------------------------------------------------------ Private Sub PlaySong() MP1.settings.autoStart = True MP1.Controls.Play MP1.URL = App.Path & "Data" & FlNms(CrntFlNm) CrntFlNm = CrntFlNm + 1 '''' Breakpoint If CrntFlNm = FlCnt Then CrntFlNm = 0 End If End Sub ------------------------------------------------------------------------------

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following