Symposium Preparation

| Paper Presentation | Games | Quiz | Remodeled Bikes |

Paper presentations :
You have 10 minutes of time , 7 min for presentation and 3 min for question time. Click here for paper presentation topics and sample papers

Our symposium should fall on this September, Enter your ideas and comments for our symposium this year here.

Cynosure rocks !!


Monday, December 21, 2009

Project 1 : Making a Multimedia CD player using Visual Basic

Hi friends, this is our First ProjectMaking a Multimedia CD player using Visual Basic


Things Needed :


A computer (of course)
visual basic 6.0


Description:


Multimedia refers to devices other than the screen or the printer to play sounds, watch videos or record music. This is done through the use of the Multimedia control. Don't look for it in the toolbox, it's not there. It is an additional control that you must load.

First, create a new form in Project Lesson7 and call it "multimed.frm". Then, in the menu, at Project --> Components, find the item "Microsoft Multimedia Control 6.0" and check the box next to it. Hit OK and that's it. The Multimedia control should now appear in your toolbox.

If you select the multimedia control and put it down on the form, you will have a button bar like all the ones you've seen on CD players, recorders, etc. In the DeviceType property you specify what type of device this control controls:



DeviceType
Device
CDAudio
CD Audio player
DAT
Digital audio tape player
Overlay
Overlay
Scanner
Scanner
Vcr
Videotape player and recorder

Example: a simple CD player

We create a new form in Lesson7 and call it multimed.frm. After adding the Multimedia control to the toolbox, we put a MM control on the form. Since we will only be using the one MM control, we'll leave its name as MMControl1. The only property we have to change at this time is the DeviceType, to tell it that we are using the CD player, so we write CDAudio in DeviceType. We add a few labels to complete the form and we get:








Now we have to write the code to operate the CD player.

Before we start to write the code there are a few things to know about the MM control. There is a Track property which contains the number of the current track. But its most important property is called the Command property and it can take on several values that, in fact, operate the device.


Command value
Meaning
Open
Opens the device
Close
Closes the device
Eject
Ejects the CD
Play
Plays the device
Pause
Pauses the device
Next
Goes to next track
Prev
Goes to beginning of current track. If used within 3 seconds of most recent Prev, goes to beginning of previous track
Record
Initializes recording
Save
Saves the open device file
Seek
Step backward or forward a track
Stop
Stops the device
Step
Step forward through tracks


Understand that both Track and Command are run-time properties because they are meaningless at design time. For example, to open the CD player:
MMControl1.Command = "Open"      'we assign the value "Open" to the Command property
To pause:
MMControl1.Command = "Pause"     'we assign the value "Pause" to the Command property

Now, as you have seen, the trick is to know with which events to associate the code that has to be written. The first one is fairly obvious: when we load the form, the Form_Load event, we will open the device. Now, one we haven't used before. When we unload the form, we will close the device. The reason is that, once launched, the device will keep on playing, even if the form is closed. So, just click on the Form_Unload event and write the code there. Finally, just to see that things are running smoothly, we will use the StatusUpdate event for the MM control to display the track being played every time the status of MMControl1 changes (change track, pause, play are all status changes).
As you will see, once the CD starts playing, you can use the buttons in the MM toolbar to control what it does.










You may notice that some of the buttons for the CD Player are not used during play. If you want you can hide these buttons from the control by using the (Custom) property. This will open an editor window that will allow you to customize the MMControl.


                            








    And thats all !! you have created your own cd player..  

Please leave your comments too !!

No comments:

Post a Comment

You Are Visitor No:

Followers