i have a program that records audio using MCI, it works great, except i erase the previous made file every time i record a new one, because i didnt use a "SaveFileDialog".
so i figure i could just replace all the "test.wav"'s with SaveFileDialog.filenameCode:Dim i As Long 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 Record_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Record.Click ' record from microphone i = mciSendString("open new type waveaudio alias RecWavFile", 0&, 0, 0) i = mciSendString("record RecWavFile", 0&, 0, 0) 'record End Sub Private Sub Save_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click ' stop and save i = mciSendString("Stop RecWavFile", 0&, 0, 0) 'stop record i = mciSendString("save RecWavFile test.wav", 0&, 0, 0) 'save i = mciSendString("close RecWavFile", 0&, 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("test.wav") End Sub Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter End Sub
any help to what i am doing wrong would be great!Code:Dim i As Long 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 Record_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Record.Click ' record from microphone i = mciSendString("open new type waveaudio alias RecWavFile", 0&, 0, 0) i = mciSendString("record RecWavFile", 0&, 0, 0) 'record End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' stop and save SaveFileDialog1.InitialDirectory = "c:\" SaveFileDialog1.DefaultExt = ".wav" SaveFileDialog1.Filter = "Wave Files|*.wav" SaveFileDialog1.FilterIndex = 1 If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Dim Filetosave As String = "save recsound " & SaveFileDialog1.FileName mciSendString(Filetosave, "", 0, 0) Else MsgBox("You no Save!!!") End If 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("test.wav") End Sub Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter End Sub![]()





Reply With Quote