【发布时间】:2016-02-08 10:22:01
【问题描述】:
我不习惯使用 InteropServices,但我正在使用 WMPLib 从控制台应用程序播放歌曲。 当我从 Visual Studio 调试应用程序时,它按预期工作。但它崩溃并给我以下异常:
Unhandled Exception: System.Runtime.InteropServices.COMException: The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
at WMPLib.IWMPPlayer4.get_controls()
at ConsoleMP3Player.Program.Main(String[] args) in C:\Users\Ibrahim\Desktop\Console.Mp3\Console.Mp3\Program.cs:line 67
当我从命令行运行它时:
C:\Users\Ibrahim\Desktop\Console.Mp3\Console.Mp3\bin\Debug>ConsoleMP3Player play
以下是play 命令的简单代码:
var _player = new WindowsMediaPlayer();
_player.URL = "Full path to a mp3 file";
_player.controls.play();
非常感谢任何帮助。
【问题讨论】:
标签: c# console-application com-interop wmplib interopservices