zoukankan      html  css  js  c++  java
  • Current thread must be set to single thread apartment (STA) mode before OLE,当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“8856f961-340a-11d0-a96b-00c04fd705a2”。

    Add the STAThreadAttribute attribute on the Main method. This attribute is required if your program access OLE related functions, like Clipboard class does.
    
    [STAThread]
    static void Main(string[] args)
    {
    }

      

    使用以下方式
    var t = new Thread(MyThreadStartMethod);
    t.SetApartmentState(ApartmentState.STA);
    t.Start();
    或者
    
    th = new System.Threading.Thread(new System.Threading.ThreadStart(
    () =>
    {
    Start.Run();
    }));
    
    th.SetApartmentState(ApartmentState.STA);
    th.Start();
    能解决
    

      参考;http://blog.sina.com.cn/s/blog_891b90e90101c4vq.html

  • 相关阅读:
    H5基础
    函数
    分支结构/循环结构
    图解 idea打jar包的步骤
    jmeter查看使用文档后总结
    Ride的使用
    Robot Framework
    jmeter+ant+jenkins
    ant
    Mysql选择合适的数据类型
  • 原文地址:https://www.cnblogs.com/shy1766IT/p/7076777.html
Copyright © 2011-2022 走看看