Authored by VB2TheMax Team
You can use the mciSendString API to record wav files.
Declare Function mciSendString Lib "Winmm" Alias "mciSendStringA" (ByVal lpstrCommand as String, ByVal lpstrReturnString as String, ByVal uReturnLength as Long, ByVal hwndCallback as Long) as Long
the first argument is the command string, the second receives return information if needed, uReturnLength is the lenght of lpstrReturnString and the last argument is used for system notifications.
commands:
CommandString="Open new type waveaudio alias RecWavFile"
' used to open the waveaudio RecWavFile
CommandString="Record RecWavFile"
'starts recording
CommandString="Pause RecWavFile"
'pauses recording
CommandString="Resume RecWavFile"
'resumes recording
CommandString="Stop RecWavFile"
'stops recording
'to set time in milliseconds
CommandString="Set RecWavFile time format milliseconds"
'to record for a few seconds then stop, type
CommandString="Record RecWavFile to 2000 wait" '2 seconds
'to save file
CommandString="Save RecWavFile " & FileName
'remember to close device
CommandString="Close RecWavFile"
all commands should be sent as follows.
retval=mciSendString(CommandString, vbNullString,0,0&)
Hope this is helpful,
ts2032