Public Class Form1
Dim Filename As String = "SoundTest.wav"
Dim Parth1 As String = "" & Application.StartupPath & "\"
Dim Parth As String = "d:\"
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Button2.Enabled = True
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
mciSendString("record recsound", "", 0, 0)
Label1.Text = "recording"
Label1.Visible = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = True
Button2.Enabled = False
mciSendString("save recsound " & Parth & Filename, "", 0, 0)
mciSendString("close recsound", "", 0, 0)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
My.Computer.Audio.Play(Parth & Filename, AudioPlayMode.WaitToComplete)
End Sub
End Class