Requirements;
Visual Basic 2008
A song (If you don't have a song, there's a song coming with Windows, the location is: C:\WINDOWS\Media and it's called 'Onestop'
1. So first what we have to do, is create a new project, name it whatever you want;
[img]http://i1091.photobucket.com/albums/i384/Bossmous/1.jpg[/img]
2. Now you should get a window like this, if you don't, repeat step 1;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/2.jpg[/IMG]
3. Now doubleclick anywhere, I decided to doubleclick in the red square area. (The red square was added by me in paint, it's not supposed to be there in your project)
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/3.jpg[/IMG]
4. You should now see the source code, now add this code. To make it work, it MUST be a valid location and the file should also be located there! Make sure the format of the file is right aswell.
Code explanation;
Spoiler (Click to View)
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/5.jpg[/IMG]
5. You should now get an error, that AxWindowsMediaPlayer1 is not declared, to do that, click on the 'Design' at the top, and then rightclick in the toolbox and click 'Choose items'
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/6.jpg[/IMG]
6. Select the COM tab, and scroll ALL the way to the bottom, and select 'Windows Media Player' and press Ok.
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/7.jpg[/IMG]
7. You should now see a Windows Media Player item in the toolbox, doubleclick it and it should appear in your project/form.
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/8.jpg[/IMG]
8. Now you can do alittle what you want, but I chose to do so it will play automatically and also hide the media player, so the form will be empty but still play music. You can do this by making your code look like this;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/9.jpg[/IMG]
9. You can also make the music play if the user would press a button or something like that, in that case, you must add a button to the form and the code should look like this;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/10.jpg[/IMG]
Now we are done! Here is the result for me; (Feel free to post yours!)
(The volume is kind of low, the song is called 'The Somatic Defilement' by 'Whitechapel'.
Extra notes;
Change the code for the location for the audio file to "AxWindowsMediaPlayer1.URL = (Application.StartupPath & "\1.mp3")" if you're going to have the audio file and the .exe file in the same folder! :)
Thanks!
Credits; 100% to Bossmous for the pictures, the text and the video.
Downloads;
Source code & done project here;
Mediafire
Uppit (Mirror)
Visual Basic 2008
A song (If you don't have a song, there's a song coming with Windows, the location is: C:\WINDOWS\Media and it's called 'Onestop'
1. So first what we have to do, is create a new project, name it whatever you want;
[img]http://i1091.photobucket.com/albums/i384/Bossmous/1.jpg[/img]
2. Now you should get a window like this, if you don't, repeat step 1;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/2.jpg[/IMG]
3. Now doubleclick anywhere, I decided to doubleclick in the red square area. (The red square was added by me in paint, it's not supposed to be there in your project)
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/3.jpg[/IMG]
4. You should now see the source code, now add this code. To make it work, it MUST be a valid location and the file should also be located there! Make sure the format of the file is right aswell.
Quote: AxWindowsMediaPlayer1.URL = ("C:\Project1\1.mp3")
Code explanation;
Spoiler (Click to View)
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/5.jpg[/IMG]
5. You should now get an error, that AxWindowsMediaPlayer1 is not declared, to do that, click on the 'Design' at the top, and then rightclick in the toolbox and click 'Choose items'
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/6.jpg[/IMG]
6. Select the COM tab, and scroll ALL the way to the bottom, and select 'Windows Media Player' and press Ok.
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/7.jpg[/IMG]
7. You should now see a Windows Media Player item in the toolbox, doubleclick it and it should appear in your project/form.
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/8.jpg[/IMG]
8. Now you can do alittle what you want, but I chose to do so it will play automatically and also hide the media player, so the form will be empty but still play music. You can do this by making your code look like this;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/9.jpg[/IMG]
9. You can also make the music play if the user would press a button or something like that, in that case, you must add a button to the form and the code should look like this;
[IMG]http://i1091.photobucket.com/albums/i384/Bossmous/10.jpg[/IMG]
Now we are done! Here is the result for me; (Feel free to post yours!)
(The volume is kind of low, the song is called 'The Somatic Defilement' by 'Whitechapel'.
Extra notes;
Change the code for the location for the audio file to "AxWindowsMediaPlayer1.URL = (Application.StartupPath & "\1.mp3")" if you're going to have the audio file and the .exe file in the same folder! :)
Thanks!
Credits; 100% to Bossmous for the pictures, the text and the video.
Downloads;
Source code & done project here;
Mediafire
Uppit (Mirror)



