当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“8856f961-340a-11d0-a96b-00c04fd705a2”...

使用webBrowser截图时出现这样一个错误:

当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“8856f961-340a-11d0-a96b-00c04fd705a2”..._第1张图片

查找了下,大部分人说的解决方法如下:

 
    
System.Threading.ThreadStart start = new System.Threading.ThreadStart(download);
System.Threading.Thread th
= new System.Threading.Thread(start);
th.ApartmentState
= System.Threading.ApartmentState.STA; // 关键
或者

 
    
[STAThread]
static void Main( string [] args)
{
}

而我最后使用的解决办法是在页头加上AspCompat="true"属性即可,不妨试试看...

转载于:https://www.cnblogs.com/pfs1314/archive/2011/06/07/2074169.html

你可能感兴趣的:(c/c++)