In this lesson, you will learn how to create a CD player that can play a music CD or DVD. It allows the user select a track to play, to fast forward, to rewind and also to eject the CD. It can also display the track being played.
To be able to play multimedia files or multimedia devices, you need to 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 need to add the MM control by pressing Ctrl+T and select it from the components dialog.
The CodePrivate 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 SubPrivate Sub myCD_StatusUpdate() 'Update the track number trackNum.Caption = myCD.Track End SubPrivate Sub Next_Click() myCD.Command ="Next" End SubPrivate Sub Play_Click() myCD.Command = "Play" End SubPrivate Sub Previous_Click() myCD.Command ="Prev" End SubPrivate Sub Stop_Click() myCD.Command = "Stop" End Sub
Copyright ® 2008 Dr.Liew Voon Kiong . All rights reserved |Contact