School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,140 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,754 people online right now. Registration is fast and FREE... Join Now!




How to make a DVD Player for VB.NET

 
Reply to this topicStart new topic

> How to make a DVD Player for VB.NET

nritzau
Group Icon



post 22 Feb, 2009 - 10:58 PM
Post #1


In this Tutorial I,m going to show you how to make a DVD Player in VB.NET.


Step 1: Stetting up the Form

Firstly create a Windows Form Application and Name the new project a name. An Example of a name would be “DVD Player”.

Attached Image





Now we would go to the properties of the form and change the text to DVD Player.

Attached Image





When you finish that you would change the size of the form to a size suitable for your screen.

Attached Image






Step 2: Adding things to your Form

Add a Menustrip and put File and Exit in your Menustrip as shown in the diagram below.

Attached Image





Now add more text in the menustrip as shown in the diagram below.

Attached Image




Now go to tools and click on choose ToolBox Items.

Attached Image





Click on the COM Components and scroll down until you find MSWebDVD Class, tick MSWebDVD and press OK.

Attached Image




Now click on MSWebDVD Class from the toolbox and add 1 MSWebDVD Class to your DVD Player.

Attached Image




Go over to the Forms Properties and scroll down to you find Dock and Change the Dock to Fill. This should make the size of MSWebDVD Class change to the full size of the DVD Player.

Attached Image






Now go to MSWebDVD Class Properties and change the name of MSWebDVD to DVD1.

Attached Image





Step 3: Adding the Code

Right Click on Form1 in the Solution Explorer and click "View Code".

Attached Image





Now type this Code Below




This code should come up when you click view code

CODE
Public Class Form1




This code is to play your DVD's so double click on your play button and input this code.

CODE
Private Sub PlayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdplay.Click
        DVD1.Play()
    End Sub




This code is to pause your DVD's so double click on your pause button and input this code.


CODE
Private Sub PauseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdpause.Click
        DVD1.Pause()
    End Sub




This code is to Stop your DVD's so double click on your Stop button and input this code.


CODE
Private Sub StopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstop.Click
        DVD1.Stop()
    End Sub



This code is to Rewind your DVD's so double click on your Rewind button and input this code.

CODE
Private Sub BackwardsX2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdbackwards.Click
        DVD1.PlayBackwards(2)
    End Sub



This code is to Fast Forward your DVD's so double click on your Fast Forward button and input this code.


CODE
Private Sub FastForwardToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdforward.Click
        DVD1.PlayForwards(2)
    End Sub



This code is for Previous Chapter on your DVD Player so double click on your Previous Chapter button and input this code.

CODE
Private Sub PreviousChapterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdchapminus.Click
        DVD1.PlayPrevChapter()
    End Sub




This code is Next Chapter for DVD Player so double click on your pause button and input this code.

CODE
    Private Sub NextChapterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextChapterToolStripMenuItem.Click
        DVD1.PlayNextChapter()
    End Sub



This code is to exit your DVD Player so double click on your exit button and input this code.


CODE
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub



This code is to input a msgbox in your DVD player to tell you that you have to insert a dvd into the disc drive

CODE
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox("Please insert a disk into drive D: or E:, Than press OK")
    End Sub



This code is to view full screen on your DVD Player.

CODE
Private Sub FullScreenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FullScreenToolStripMenuItem.Click
        DVD1.FullScreenMode() = True

    End Sub



This code is to your code this goes after you input all your codes it should be there already.

CODE
End Class



Attached Image


I hope you have enjoyed my tutorial and I hope you know now How to make a DVD Player.

If you have any problems please post in this forum and I can fix up the problems.

This post has been edited by nritzau: 24 Feb, 2009 - 09:42 PM
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

rajaraman.u
*



post 4 Mar, 2009 - 09:55 AM
Post #2
Could you tell me how to write code for playing a file located on harddisk.

I want to select the file from file->open and search my own music files
Go to the top of the page
+Quote Post

cbrickhouse
**



post 4 Mar, 2009 - 10:00 AM
Post #3
QUOTE(rajaraman.u @ 4 Mar, 2009 - 09:55 AM) *

Could you tell me how to write code for playing a file located on harddisk.

I want to select the file from file->open and search my own music files


modify the code to use an openfiledialog.

something like this

CODE
Private fdlg As OpenFileDialog = New OpenFileDialog()
Private fdlg.Title = "C# Corner Open File Dialog"
Private fdlg.InitialDirectory = "c:\"
Private fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
Private fdlg.FilterIndex = 2
Private fdlg.RestoreDirectory = True
If fdlg.ShowDialog() = DialogResult.OK Then
textBox1.Text = fdlg.FileName
End If


This post has been edited by cbrickhouse: 4 Mar, 2009 - 10:01 AM
Go to the top of the page
+Quote Post

nritzau
Group Icon



post 4 Mar, 2009 - 12:15 PM
Post #4
QUOTE(rajaraman.u @ 4 Mar, 2009 - 09:55 AM) *

Could you tell me how to write code for playing a file located on harddisk.

I want to select the file from file->open and search my own music files


Hey rajaraman.u, try something like this

CODE
OpenFileDialog1.InitialDirectory = My.Computer.FileSystem.CurrentDirectory

        OpenFileDialog1.ShowDialog()

        DVD1.URL = OpenFileDialog1.FileName



Type the code below in the filter box in the properties of the open file dialog.

Video Files |*.WMV;* .mp4;* .avi

This code will make you play WMV, mp4 and .avi.

This post has been edited by nritzau: 4 Mar, 2009 - 12:16 PM
Go to the top of the page
+Quote Post

nritzau
Group Icon



post 4 Mar, 2009 - 12:31 PM
Post #5
QUOTE(rajaraman.u @ 4 Mar, 2009 - 09:55 AM) *

Could you tell me how to write code for playing a file located on harddisk.

I want to select the file from file->open and search my own music files


Sorry about that i miss read it i will give you the code for the music files:

CODE
OpenFileDialog1.InitialDirectory = My.Computer.FileSystem.CurrentDirectory

        OpenFileDialog1.ShowDialog()

        DVD1.URL = OpenFileDialog1.FileName

    End Sub


Type the code below in the filter box in the properties of the open file dialog.

Music Files |*.mp3;* .wma;* .wav

This code will make you play Music Files |*.mp3;* .wma;* .wav
Go to the top of the page
+Quote Post

myhaksown
*



post 28 Mar, 2009 - 09:11 PM
Post #6
I Can't find MSWebDVD where do I get it other then the place given?
Go to the top of the page
+Quote Post

Magic_Man
Group Icon



post 4 Apr, 2009 - 05:46 PM
Post #7
QUOTE(myhaksown @ 28 Mar, 2009 - 09:11 PM) *

I Can't find MSWebDVD where do I get it other then the place given?


Try looking for WMPlayer. I had the same problem finding it. It may or may not do the same thing. I'm not sure. I haven't messed around with the WMPlayer control much yet.

This post has been edited by Magic_Man: 4 Apr, 2009 - 05:52 PM
Go to the top of the page
+Quote Post

Orpheus
*



post 7 May, 2009 - 04:58 AM
Post #8
Hey, how do I get volume ? cos I've tried all sorts, and DVD1.volume only accepts 0 as an augment :S
Go to the top of the page
+Quote Post

nritzau
Group Icon



post 10 May, 2009 - 04:32 AM
Post #9
QUOTE(Orpheus @ 7 May, 2009 - 04:58 AM) *

Hey, how do I get volume ? cos I've tried all sorts, and DVD1.volume only accepts 0 as an augment :S


Hey Orpheus, Go to this website it should help your dvd volume problem http://msdn.microsoft.com/en-us/library/ms788103(VS.85).aspx

This post has been edited by nritzau: 10 May, 2009 - 04:34 AM
Go to the top of the page
+Quote Post

Orpheus
*



post 10 May, 2009 - 08:28 AM
Post #10
hum, I did try but it seems to have failed, I think it might be because i'm on vista?
Go to the top of the page
+Quote Post

nritzau
Group Icon



post 13 May, 2009 - 01:23 PM
Post #11
QUOTE(Orpheus @ 10 May, 2009 - 08:28 AM) *

hum, I did try but it seems to have failed, I think it might be because i'm on vista?


It could be i use to be on XP and it worked fine but now with vista i can't even find MSWebDVD Class.
Go to the top of the page
+Quote Post

nritzau
Group Icon



post 13 May, 2009 - 01:29 PM
Post #12
QUOTE(Orpheus @ 10 May, 2009 - 08:28 AM) *

hum, I did try but it seems to have failed, I think it might be because i'm on vista?

Are you using MSWebDVD Class?
Go to the top of the page
+Quote Post

Orpheus
*



post 13 May, 2009 - 01:39 PM
Post #13
Yeah I am, I downloaded it from the Microsoft repository so it's the latest version too. . . not quite sure why I can't get the volume to work on it, the link you provided on the 10th was contradictory as it said 0 was both silent and full volume :S

I also have some DVD players installed, so it might be one of them?
Go to the top of the page
+Quote Post

palalooya
*



post 24 Aug, 2009 - 07:58 PM
Post #14
QUOTE(Orpheus @ 13 May, 2009 - 01:39 PM) *

Yeah I am, I downloaded it from the Microsoft repository so it's the latest version too. . . not quite sure why I can't get the volume to work on it, the link you provided on the 10th was contradictory as it said 0 was both silent and full volume :S

I also have some DVD players installed, so it might be one of them?



Click Here to download

download file above and dump the file in in System 32folder

then you will have the MSWebDVD.dll

This post has been edited by palalooya: 24 Aug, 2009 - 07:59 PM
Go to the top of the page
+Quote Post

crzyone9584
*



post 15 Sep, 2009 - 08:26 PM
Post #15
CODE
OpenFileDialog1.InitialDirectory = My.Computer.FileSystem.CurrentDirectory

        OpenFileDialog1.ShowDialog()

        DVD1.URL = OpenFileDialog1.FileName

    End Sub


that Doesn't work. the .url is not part of the webdvd player.
Go to the top of the page
+Quote Post


Fast ReplyReply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/21/09 03:29PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month