VB2022 VB2019 VB6 VB Sample Code About Us

Lesson 19: Creating a DVD Player


In this lesson, you will learn how to create an elegant DVD player for playing music CDs and DVDs. It empowers the user with the ability to choose specific tracks, fast forward, rewind, and eject the DVD. Besides that, this application also boasts a sleek display feature highlighting the currently playing track.

To enable the application to play multimedia files or multimedia devices, you must insert Microsoft Multimedia Control into your VB application that you are going to create. However, Microsoft Multimedia Control is not included in the startup toolbox by default, you must add the  MM control by pressing Ctrl+T and select it from the components dialog.

Figure 19.1 The DVD Player

The Code

Private Sub Form_Load() 
'To position the page at the center 
Left = (Screen.Width - Width) \ 2 
Top = (Screen.Height - Height) \ 2 
'Initialize the CD
myCD.Command = "Open"
End Sub 
Private Sub myCD_StatusUpdate() 
'Update the track number 
trackNum.Caption = myCD.Track 
End Sub 
Private Sub Next_Click()
myCD.Command ="Next"
End Sub
Private Sub Play_Click()
myCD.Command = "Play"
End Sub 
Private Sub Previous_Click()
myCD.Command ="Prev"
End Sub
Private Sub Stop_Click()
myCD.Command = "Stop"
End Sub 



Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy