Create a new form and add 3 button to your form and Rename the buttons as the following: Record, Save and Play as shown below:
Go to the code page and add the following declaration:
- Private Declare Function record Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Record Button Code
- Private Sub Record_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- record("open new Type waveaudio Alias recsound", "", 0, 0)
- record("record recsound", "", 0, 0)
- End Sub
Stop and Save Button Code
- Private Sub Stop_and_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- record("save recsound D:\Manish\mbp.wav", "", 0, 0)
- record("close recsound", "", 0, 0)
- End Sub
Play Button Code
- Private Sub Play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
- My.Computer.Audio.Play("D:\Manish\mbp.wav", AudioPlayMode.Background)
- End Sub