[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback); private void StartRecording_btn_Click(object sender, EventArgs e) { mciSendString("open new Type waveaudio Alias recsound", "", 0, 0); mciSendString("record recsound", "", 0, 0); } private void StopRecording_btn_Click(object sender, EventArgs e) { mciSendString("save recsound C:\\Users\\FUJITSU\\Desktop\\record\\result.wav", "", 0, 0); mciSendString("close recsound ", "", 0, 0); }