解决方法:
在主程序的入口处加上[STAThread],原来framework为运行com组件时,为提高性能默认使用多线程,但有的com组件不能使用多线程,否则就报错.
例:
[STAThread]
public static void Main()
{
frmMain f = new frmMain();
f.Show();
Application.Run(f);
}
文章转自:http://hi.baidu.com/yanwei99521/blog/item/c5743f2e4e3608564fc226df.html
在主程序的入口处加上[STAThread],原来framework为运行com组件时,为提高性能默认使用多线程,但有的com组件不能使用多线程,否则就报错.
例:
[STAThread]
public static void Main()
{
frmMain f = new frmMain();
f.Show();
Application.Run(f);
}
文章转自:http://hi.baidu.com/yanwei99521/blog/item/c5743f2e4e3608564fc226df.html
本文介绍了解决在.NET框架中使用某些不支持多线程的COM组件时出现的错误的方法。通过在主程序入口处添加[STAThread]属性,可以确保应用程序以单线程模式运行,从而避免因多线程而导致的问题。
7758

被折叠的 条评论
为什么被折叠?



