Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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:
C#
<STAThread()> _
 
Share this answer
 
Thanks for your reply . .
The code which starts the application is given below . .
C#
static class Program
   {  [STAThread]
       static void Main()
       {
           Application.EnableVisualStyles();
           Application.SetCompatibleTextRenderingDefault(false);
           Application.Run(new mainForm());
       }
   }
 
Share this answer
 
Comments
hacker_0007 25-Feb-12 13:37pm    
WMPLib.WMPEqualizerSettingsCtrl eq=null;
WMPLib.WMPEqualizerSettingsCtrl eq=null;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900