|
-
Apr 22nd, 2010, 03:53 PM
#1
Thread Starter
Addicted Member
Playing music
Hello everybody!
I want when I click on some button, computer run some music file from specified path (for example C:\path) and to start playing music from this file but without running any programs, just like background of the program.
Thanks!
-
Apr 22nd, 2010, 04:03 PM
#2
Addicted Member
Re: Playing music
Try the mediaplayer control, it's very simple.
-
Apr 22nd, 2010, 04:09 PM
#3
Thread Starter
Addicted Member
Re: Playing music
Sorry, where do you see 'mediaplayer' control in Visual Studio 2008?!
Last edited by hepeci; Apr 22nd, 2010 at 04:21 PM.
-
Apr 23rd, 2010, 12:28 PM
#4
Addicted Member
Re: Playing music
Go to Solution Explorer -> Add reference -> In the COM tab find Windows Media Player and add to the project. Next add this code:
Code:
Public Class Form1
Dim player As WindowsMediaPlayer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim player As New WindowsMediaPlayer
player.URL = path_to_the_file
End Sub
End Class
-
Apr 23rd, 2010, 01:33 PM
#5
Thread Starter
Addicted Member
Re: Playing music
OK, this works. But, how to stop music in some moment?
-
Apr 23rd, 2010, 02:49 PM
#6
Thread Starter
Addicted Member
Re: Playing music
Actually, when I click button I want that program stop reproducing song.
-
Apr 25th, 2010, 03:40 AM
#7
Lively Member
Re: Playing music
In the click event of your stop button add the following:
Code:
player.Ctlcontrols.stop()
-
Apr 25th, 2010, 06:06 AM
#8
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|