View contents of this chapter

Example

In this section, we will develop a very simple audio CD player. The source code needed for this example is stored in the "Source Code\Chapter20\CD Player" directory.

Private Sub Form_Load()
    ' specify the type of MCI device
    MMControl1.DeviceType = "CDAudio"
    ' Open the CD
    MMControl1.Command = "Open"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    ' closs the device
    MMControl1.Command = "Close"
End Sub

Private Sub MMControl1_StatusUpdate()
    ' update the track number every time
    ' the CD's status changes
    lblTrack.Caption = MMControl1.Track
End Sub


The application opens the CD playing multimedia control when the form first loads. In the form unload event, the code removes the CD player from memory. In the StatusUpdate sub procedure, the code updates the track number every time the CD's status changes.



© Universal Teacher Publications        INDEX Previous Screen Next Screen