Link to home
Start Free TrialLog in
Avatar of michaelair
michaelair

asked on

how to play sound in vb5?

hi guys,
how to play the midi sound / mp3 sound in vb5?

thanx alot
ASKER CERTIFIED SOLUTION
Avatar of Jason_G
Jason_G

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason_G
Jason_G

Hi michaelair,
A change to my note above, in the Books Online, search area, simply type multimedia control, and the article you need to click on after typing that in is Using the Multimedia Control.

Good luck!

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
Hi michaelair,
here is some sample code to get you started;

The following example illustrates the procedure used to open an MCI device with a compatible data file. By placing this code in the Form_Load procedure, your application can use the multimedia MCI control “as is” to play, record, and rewind the multimedia file DING.WAV. To try this example, first create a form with a multimedia MCI control.

Private Sub Form_Load ()
      ' Set properties needed by MCI to open.
      Form1.MMControl1.Notify = FALSE
      Form1.MMControl1.Wait = TRUE
      Form1.MMControl1.Shareable = FALSE
      Form1.MMControl1.DeviceType = "WaveAudio"
      Form1.MMControl1.FileName = "C:\WINDOWS\DING.WAV"

      ' Open the MCI WaveAudio device.
      Form1.MMControl1.Command = "Open"
End Sub

To properly manage multimedia resources, you should close those MCI devices that are open before exiting your application. You can place the following statement in the Form_Unload procedure to close an open MCI device before exiting from the form containing the multimedia MCI custom control.

Private Sub Form_Unload ()
      MMControl1.Command = "Close"
End Sub

This should help you get started with the coding.

Good luck.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
Avatar of michaelair

ASKER

and then for mp3 files?
Hi michaelair,
To use Mp3 files, you could put an ole control on your form, then when it prompts you for a file, browse to an mp3 file, then when you run your project, it will automatically launch WinAmp, or whatever player you use to play MP3's.

If you need more information just ask.

Good luck.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
thanx alot..
next time if i hav any doubt ,can i staright send email 2 u ?
thanx again