在C#中使用WMPLib.WMPEqualizerSettingsCtrl [英] Using WMPLib.WMPEqualizerSettingsCtrl in C#

查看:104
本文介绍了在C#中使用WMPLib.WMPEqualizerSettingsCtrl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要访问媒体播放器的均衡器控制,我正在使用WMPLib.WMPEqualizerSettingsCtrl
但是实例化时有一个COMException.如何解决呢?

谢谢.

To access equlaizer control of media player i am using WMPLib.WMPEqualizerSettingsCtrl
But there is an COMException while instantiating. How to solve this?

Thank you.

推荐答案

要变通解决此问题,请确保实例化线程在STA中运行.
如果使用MTAThread属性指定主机应用程序的主线程在MTA中运行,则必须改用STAThread属性.为此,将"MTAThread"代码替换为以下代码:
To work around this problem, make sure that the instantiating thread runs in an STA.

If you use the MTAThread attribute to specify that the main thread of the host application runs in an MTA,you must use the STAThread attribute instead. To do this, replace the code of ''MTAThread'' with the following code:
<STAThread()> _


感谢您的回复. .
启动该应用程序的代码如下. .
Thanks for your reply . .
The code which starts the application is given below . .
static class Program
   {  [STAThread]
       static void Main()
       {
           Application.EnableVisualStyles();
           Application.SetCompatibleTextRenderingDefault(false);
           Application.Run(new mainForm());
       }
   }


WMPLib.WMPEqualizerSettingsCtrl eq = null;
WMPLib.WMPEqualizerSettingsCtrl eq=null;


这篇关于在C#中使用WMPLib.WMPEqualizerSettingsCtrl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆