Lesson 15: Creating Multimedia Applications
You can create various multimedia applications in VB that couold play audio CD, audiofiles, VCD , video files and etc.
To be able to play multimedia files or multimedia devices, you have to insert Microsoft Multimedia Control into your VB applications
that you are going to create. However, Microsoft Multimedia Control is not normally included in the startup toolbox, therefore you need
to add the MM control by pressing Ctrl+T and select it from the components dialog box that is displayed.
15.1 Creating a CD player
(a) The Interface.
First of all, you place a Multimedia control into your form and rename it as any name of your choice. Here I use myCD to replace the default name MMControl1. Next, you can put two labels on your form, change caption of the left label to Track and rename the one on the right to trackNum and make its caption invisible(this lable is to display CD track numbers at runtime.). Finally, put five command buttons in your form and name them as Play, Next, Previous, Stop and Exit. You can also choose to make the MM Control visible or invisible at runtime. If you choose to make it visible,you could play the CD using the buttons available on the control itself or you can click on the buttons at the bottom that are created by you.
(b) The Code
Private Sub Form_Load()
‘To position the page at the center
Left = (Screen.Width – Width) \ 2
Top = (Screen.Height – Height) \ 2
‘Open the CD
myCD.Command = “Open”
Private Sub myCD_StatusUpdate()
‘Update the track number
trackNum.Caption = myCD.Track
Private Sub Next_Click()
myCD.Command = “Next”
Private Sub Play_Click()
myCD.Command = “Play”
Private Sub Previous_Click()
myCD.Command = “Prev”
Private Sub Stop_Click()
myCD.Command = “Stop”
Private Sub Exit_Click()