Mann Maurya

Mann Maurya

  • NA
  • 104
  • 8.7k

I want to record Sound File and Save it in Folder

Aug 18 2020 2:04 AM
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int record(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
protected void btnRecord_Click(object sender, EventArgs e)
{
record("open new Type waveaudio Alias recsound", "", 0, 0);
record("record recsound", "", 0, 0);
}
protected void btnStop_Click(object sender, EventArgs e)
{
record("save recsound D:\\Record\\" + txtname.Text + ".wav", "", 0, 0);
record("close recsound", "", 0, 0);
Computer c = new Computer();
c.Audio.Stop();
}
 
This code sample I Got from internet .
This code is working intermittently, sometimes its saves file and some time its not.
 
Thanks!! 
 

Answers (2)