danab
Jan 10th, 2000, 10:39 PM
Is there a quick way of recording a .wav file via VB.
I know how to play a wav file using the API call sndPlaySound, but I'm not sure if API is possible or the best solution.
Is the multimedia component a better and possible solution??
Thanks.
Dan.
ChrisJackson
Jan 11th, 2000, 01:53 AM
Hi Dan.
Here's how to do it!
Create a new VB project. Add a multimedia control ("Project...Components...M$ Multimedia Control") and a command button to the form.
In the properties for the Multimedia control, be sure that PlayEnabled, PlayVisible, PrevEnabled, PrevVisible, RecordEnabled and RecordVisible are all set to TRUE.
Go to the VB Editor and paste this code:
Option Explicit
Private Sub Command1_Click()
End 'the program
End Sub
Private Sub Form_Load()
'Set properties needed by MCI to open.
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = "c:\test3.wav"
' Open the MCI WaveAudio device.
MMControl1.Command = "Open"
End Sub
Now run the program.
Click on the Round button (record) to make a new recording. Click on the rewind button and then the play button to hear the recorded file.
All the best.
Chris