【问题标题】:C# MciSendString Recording, Works in debug, not deployedC# MciSendString 记录,在调试中工作,未部署
【发布时间】:2012-04-16 14:27:57
【问题描述】:

我真的希望有人能以此为我指明正确的方向。当我在 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());

【问题讨论】:

    标签: c# winmm mci


    【解决方案1】:

    好吧,我通过实际指定一个文件将其保存为...

    string outs = "";
    //Inside another button function
    int i = mciSendString(@"save recsound C:/test.wav", ref outs, 0, 0);
    

    我也将 out 参数更改为 ref,但我怀疑这与它有什么关系。

    【讨论】:

      【解决方案2】:

      您要播放什么类型的文件?它部署在哪里?我最近遇到了同样的问题;我无法在我的一台测试机器上播放 .mp3s 或 .wmas(我收到相同的错误:263)。我安装了 Windows Media Player 并且它们工作正常,所以这让我相信缺少编解码器。现在我只需要弄清楚它是什么编解码器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多