In previous lesson, we have programmed a CD player. Now, with some modifications, we will transform the CD player into an audio file player. This player will be created in such a way that it could search for wave and midi files in your drives and play them.
In this project, you need to insert a ComboBox, a DriveListBox, a DirListBox, a TextBox and a FileListBox into your form.I Shall briefly discuss the function of each of the above controls. Besides, you must also insert Microsoft Multimedia Control(MMControl) in your form , you may make it visible or invisible. In my program, I choose to make it invisible so that I can use the command buttons created to control the player.
Relevant code must be written to coordinate all the above controls so that the application can work properly. The program should follow in the following logical way:
Step 1: User choose the type of files he wants to play.
Step2:User selects the drive that might contains the relevant audio files.
Step 3:User looks into directories and subdirectories for the files specified in step1. The files should be displayed in the FileListBox.
Step 4: User selects the files from the FileListBox and click the Play button.
Step 5: User click on the Stop to stop playing and Exit button to end the application.
| The Interface
|
|
|
The Code Private Sub Combo1_Change() If ListIndex = 0 Then 'To change directories and subdirectories(or folders and subfolders)
File1.Path = Dir1.Path |
|
|
Private Sub Drive1_Change() 'To change drives Dir1.Path = Drive1.Drive End Sub 'To center the Audioplayer startup page
Left = (Screen.Width - Width) \ 2
|
'To play WaveAudio file or Midi File
Command2_Click |