我真的希望有人能指出我正确的方向。当我在 Visual Studio Express 2010 中调试时,此代码可以完美运行,但在构建和部署时给我 mci 错误 263 - “指定的设备未打开或被 mci 识别”。
我尝试过修改构建设置,但没有任何乐趣。当然这一定是配置问题而不是代码?
任何人都可以提供的任何帮助将不胜感激。
----- 代码如下 ----
[DllImport("winmm.dll")]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
[System.Runtime.InteropServices.DllImport("winmm.dll")]
private static extern bool mciGetErrorString(int fdwError, StringBuilder lpszErrorText, int cchErrorText);
///Inside a button function
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
//Inside another button function
int i = mciSendString(@"save recsound C:/test22/sound", outs, 0, 0);
MessageBox.Show(""+i);
StringBuilder buffer = new StringBuilder(128);
bool returnValue = mciGetErrorString(i, buffer, buffer.Capacity);
string err = buffer.ToString();
MessageBox.Show(buffer.ToString());