0
我不习惯使用InteropServices,但我正在使用WMPLib
播放控制台应用程序中的歌曲。 当我从Visual Studio进行调试时,该应用程序按预期工作。但它崩溃,并让我有以下异常:媒体播放中的WMPLib控制台应用程序异常
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();
任何帮助,非常感谢。
我会试试它,但为什么它会在Visual Studio中工作呢? – lbrahim
我会托盘避免发表评论,例如“这是一个糟糕的COM控件”,而是告诉你控件可能需要一些表单引用才能正常工作,VS主机可能提供哪些功能?不太确定,但托管组件反正好得多。 –