If MediaPlayer1.playState = wmppsStopped And frmSetup.Songopt(1).Value = True And Not s > frmSetup.Lstsongs.ListCount Then
'Play the next song in the list
s = s + 1
play (s)
End If
End Sub
frmSetup code:
vb Code:
Private Sub cmdBack_Click()
hideme
End Sub
Private Sub hideme()
Me.Hide
frmMain.Show
End Sub
Comments or ideas on how I can improve the project are welcome. I might create a great project if I get enough ideas.
Nightwalker
Last edited by Nightwalker83; May 27th, 2012 at 11:37 PM.
Reason: Adding new project!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
You could improve that code a bit.
Try adding an Option Explicit at the very top of code and see the magic.
Also, you could avoid using labels to loop the code. Why not use a loop instead ?
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Remake of my MP3 Player using Windows Media Player
Here's an example for avoiding the label in your code:
vb Code:
Option Explicit
Private Sub Command1_Click()
Dim myMsgResult As VbMsgBoxResult
Do
myMsgResult = MsgBox("Do you want to continue reading my post ?", vbQuestion + vbYesNo, "Do you wanna risk yourself ?")
If myMsgResult = vbYes Then
'do some blah..blah here...
Else
Exit Do '~~~ This will exit the loop
End If
Loop
End Sub
Also, try indenting your code next time, which makes it easy for reading.
Good luck
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Remake of my MP3 Player using Windows Media Player
Originally Posted by akhileshbc
Here's an example for avoiding the label in your code:
Where did I use labels?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
Originally Posted by Nightwalker83
Where did I use labels?
Code:
Private Sub mnuPlay_Click()
'If cancel then close the program
'Else choose and play a song
Music1.ShowOpen
frmSetup.Lstsongs.AddItem Music1.FileName
Repeat:
x = MsgBox("Do you want to add more songs?", vbYesNo)
If x = vbYes Then
Music1.ShowOpen
frmSetup.Songopt(1).Value = True
frmSetup.Lstsongs.AddItem Music1.FileName
GoTo Repeat
ElseIf x = vbNo Then
play (s)
mnuPlay.Checked = True
mnuStop.Checked = False
tmrDuration.Enabled = True
End If
If x = vbNo And frmSetup.Lstsongs.Text = "" Or Err.Number = "32755" Then
'Stop the player
MediaPlayer1.Close
x = vbNo
Unload Me
End If
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Remake of my MP3 Player using Windows Media Player
Originally Posted by stlaural
I believe akhileshbc is talking about the 'goto' you are using.
Yes
Originally Posted by stlaural
Edit: Woops, I was typing at the same time I guess :P
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
I have uploaded the new project to the first post.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
I think, you should check on the Fast Forward option. You haven't provided a way to switch back to normal play mode from FastFroward.
Also, you could display some information on the main form. Because it is empty at the moment. You could place the album/song name, duration, etc.
Even you could include some graphic images to provide a feel like Winamp.(No need to do the advanced coding)
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Remake of my MP3 Player using Windows Media Player
'How to use the Windows Media Player
'control (version 11.0) in Visual Basic 6.0 to play music
'Date: 15/04/2011
'Update: 16/04/2011: Moved all the methods to a module, fixed the fastforward and fastrewind options.
'Also added to hide/show the mp3 payer to/from the system tray
'Update: 17/04/2011: Changed the background colour of all the forms and controls
'Update: 18/04/2011: Allowed user to change the colour of the program via the change colour api.
'Update: 19/04/2011: Added the Common Dialog api by Ellis Dee instead of using the common dialog control
'Update: 21/04/2011: Added ability to retrieve current song information from the song tags and display it on the main form.
'Update: 24/04/2011: Added Randy Birch's code to disable the x button of frmSetup incase the user sets the form's toolbox to true
'Swapped the no result code for the add more songs option so that if the user chooses not to add any song when
'the list is empty the result causes the program exit the sub normally instead of causing an error.
'Update: 26/04/2011:'Made minor adjustment to the sLoad code because of a bug, also added code to cler the song details of the current song
'displayed on the form ready for the next songs details.
'If the index of the song being is played less than the total count of the song list
'Play the next song if not stop the player
'Added filters to the common dialog box
'Author: Aaron Spehr
'Alias: Nightwalker83
'Website: http://aaronspehr.net/
Edit:
I made a minor adjustment to the load to stop the above error from occurring. This code is slightly different to the code that is in the project.
vb Code:
Public Sub sLoad()
'If cancel then close the program
'Else choose and play a song
frmMain.mnuPlay.Checked = True
frmMain.mnutrayPlay.Checked = True
frmMain.mnuStop.Checked = False
frmMain.mnutraystop.Checked = False
frmSetup.Lstsongs.AddItem ShowOpenDialog(App.Path, "All Files|*.*", "*.*")
Do
X = MsgBox("Do you want to add more songs?", vbYesNo)
If X = vbYes Then
frmSetup.Songopt(1).Value = True
frmSetup.Lstsongs.AddItem ShowOpenDialog(App.Path, "All Files|*.*", "*.*")
End If
If X = vbNo Then
DoEvents
play (s)
songinfo (s)
frmMain.tmrDuration.Enabled = True
Exit Do
End If
Loop
If X = vbNo And frmSetup.Lstsongs.Text = "" Or Err.Number = "32755" Then
'Stop the player
frmMain.tmrDuration.Enabled = False
Exit Sub
End If
End Sub
Edit:
See first post for attachments.
Last edited by Nightwalker83; May 30th, 2011 at 07:07 PM.
Reason: Fixed spelling!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
'How to use the Windows Media Player
'control (version 11.0) in Visual Basic 6.0 to play music
'Date: 15/04/2011
'Update: 16/04/2011: Moved all the methods to a module, fixed the fastforward and fastrewind options.
'Also added to hide/show the mp3 payer to/from the system tray
'Update: 17/04/2011: Changed the background colour of all the forms and controls
'Update: 18/04/2011: Allowed user to change the colour of the program via the change colour api.
'Update: 19/04/2011: Added the Common Dialog api by Ellis Dee instead of using the common dialog control
'Update: 21/04/2011: Added ability to retrieve current song information from the song tags and display it on the main form.
'Update: 24/04/2011: Added Randy Birch's code to disable the x button of frmSetup incase the user sets the form's toolbox to true
'Swapped the no result code for the add more songs option so that if the user chooses not to add any song when
'the list is empty the result causes the program exit the sub normally instead of causing an error.
'Update: 26/04/2011: Made minor adjustment to the sLoad code because of a bug, also added code to cler the song details of the current song
'displayed on the form ready for the next songs details.
'If the index of the song being played is less than the total count of the song list
'Play the next song if not stop the player
'Added filters to the common dialog box
'Update: 30/5/2011: Added code so if the user want to add more songs after the inital selection
'the player will go back the directory when the stored the last selected song
'Author: Aaron Spehr
'Alias: Nightwalker83
'Website: http://aaronspehr.net/
Edit:
See first post for attachment!
Last edited by Nightwalker83; May 30th, 2011 at 07:08 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
Maybe you could try removing the attachment in first post and re-uploading it there. Some might not scroll to the bottom to get the latest version
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Remake of my MP3 Player using Windows Media Player
Originally Posted by akhileshbc
Maybe you could try removing the attachment in first post and re-uploading it there. Some might not scroll to the bottom to get the latest version
I have followed your advice.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
'How to use the Windows Media Player
'control (version 11.0) in Visual Basic 6.0 to play music
'Date: 15/04/2011
'Update: 16/04/2011: Moved all the methods to a module, fixed the fastforward and fastrewind options.
'Also added to hide/show the mp3 payer to/from the system tray
'Update: 17/04/2011: Changed the background colour of all the forms and controls
'Update: 18/04/2011: Allowed user to change the colour of the program via the change colour api.
'Update: 19/04/2011: Added the Common Dialog api by Ellis Dee instead of using the common dialog control
'Update: 21/04/2011: Added ability to retrieve current song information from the song tags and display it on the main form.
'Update: 24/04/2011: Added Randy Birch's code to disable the x button of frmSetup incase the user sets the form's toolbox to true
'Swapped the no result code for the add more songs option so that if the user chooses not to add any song when
'the list is empty the result causes the program exit the sub normally instead of causing an error.
'Update: 26/04/2011: Made minor adjustment to the sLoad code because of a bug, also added code to cler the song details of the current song
'displayed on the form ready for the next songs details.
'If the index of the song being played is less than the total count of the song list
'Play the next song if not stop the player
'Added filters to the common dialog box
'Update: 30/05/2011: Added code so if the user want to add more songs after the inital selection
'the player will go back to the directory where the last selected song was stored
'Update: 21/08/2011:'Added code to display the Windows login screen if the user if idle for 5 minutes,
'thanks to Young Buck for the code to detect if the user is idle:
'http://www.vbforums.com/showthread.php?p=193692#post193692
'Added music icon to the player to replace the default Visual Basic icon
'Update: 27/05/2012 'Minor adjustments allowing the user to configure whether or no the program
'locks the work station after 5 minutes
'copied the call to close everything into unload_form event of the main form
'ensuring that the programs quits without staying an active process
'Author: Aaron Spehr
'Alias: Nightwalker83
'Website: http://aaronspehr.net/
Last edited by Nightwalker83; Oct 9th, 2012 at 02:39 AM.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
Looks useful I started a player my self in VB6 Years back and never finished it, I like the little home grown projects, anyway some ideas.
Add skins you could use the old win amp 2x ones, Using bitblt it be easy to implant
Add a play list
Add feature to play Audio CDs
How about adding feature for volume.
Well that some things to keep you busy I post more if I think of any.
Keep up the good work.
Re: Remake of my MP3 Player using Windows Media Player
I think the thing to do next is to get it to work without using Windows Media Player. I'm tried converting it before but I had not idea how the non Media Player would fit in to the project.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
Originally Posted by Nightwalker83
I think the thing to do next is to get it to work without using Windows Media Player. I'm tried converting it before but I had not idea how the non Media Player would fit in to the project.
How I did mine years ago was using mciSendString there is a lot of things that you can do that already in your player and more. I did write a class in C# so I may convert it to VB6 if I have time, or I can send you it as it is just pm me.
Re: Remake of my MP3 Player using Windows Media Player
I have uploaded the new version which includes repeat as well as load/save the playlist, see post #14 for the download.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672
Re: Remake of my MP3 Player using Windows Media Player
I changed the save code in the latest version so that it won't save if lstSongs is empty.
vb Code:
Private Sub mnuSave_Click()
If FileExists(App.Path & "/PlayList.txt") Then mnuLoad.Visible = True
If Lstsongs.ListCount = 0 Then Exit Sub
saveList
End Sub
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu. https://get.cryptobrowser.site/30/4111672