Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Command1_Click() '录制
mciSendString "set wave bitpersample 8", "", 0, 0 '设为8位
mciSendString "set wave samplespersec 5000", "", 0, 0 '设置录制频率为5000
mciSendString "set wave channels 2", "", 0, 0 '设为立体声
mciSendString "set wave format tag pcm", "", 0, 0 '实现PCM格式(不一定正确)
'----------------------------------------初始化
mciSendString "close movie", 0&, 0, 0
mciSendString "open new type WAVEAudio alias movie", 0&, 0, 0
mciSendString "record movie", 0&, 0, 0
'----------------------------------------开始录音
End Sub
Private Sub Command2_Click() '保存
mciSendString "stop movie", 0&, 0, 0
mciSendString "save movie C:\123.wav", 0&, 0, 0
mciSendString "close movie", 0&, 0, 0
End Sub