'Above Public Class Form1 ' FormName
' This will allow you to use api access on winmm.dll
<DllImport("winmm.dll", EntryPoint:="mciSendStringA", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
Private Shared Function mciSendString(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
End Function
'This code can go in a button or form load, or whatever event you want to trigger the recording
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
mciSendString("record recsound", "", 0, 0)
' Save The Sound File as a wav called test123 in the location c:\test\
mciSendString("save recsound c:\test\test123.wav", "", 0, 0)
mciSendString("close recsound ", "", 0, 0)
Dim Comp1 As New Computer()
Comp.Audio.[Stop]()
' Play Back the File
Dim Comp2 As New Computer()
Comp2.Audio.Play("c:\test\test123.wav", AudioPlayMode.Background)
[/php]
You can also create a function for each to keep code clean and allow you to change names etc.