01.
Public
Class
Form1
02.
Dim
Filename
As
String
=
"SoundTest.wav"
03.
Dim
Parth1
As
String
=
""
& Application.StartupPath &
"\"
04.
Dim
Parth
As
String
=
"d:\"
05.
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
06.
Private
Sub
Button1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
07.
Button1.Enabled =
False
08.
Button2.Enabled =
True
09.
mciSendString(
"open new Type waveaudio Alias recsound"
,
""
, 0, 0)
10.
mciSendString(
"record recsound"
,
""
, 0, 0)
11.
Label1.Text =
"recording"
12.
Label1.Visible =
True
13.
End
Sub
14.
15.
Private
Sub
Button2_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button2.Click
16.
Button1.Enabled =
True
17.
Button2.Enabled =
False
18.
mciSendString(
"save recsound "
& Parth & Filename,
""
, 0, 0)
19.
mciSendString(
"close recsound"
,
""
, 0, 0)
20.
End
Sub
21.
Private
Sub
Button3_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button3.Click
22.
My.Computer.Audio.Play(Parth & Filename, AudioPlayMode.WaitToComplete)
23.
End
Sub
24.
End
Class