因此,在this之後,我決定在專用的STA線程上顯式實例化一個COM對象。實驗表明,COM對象需要一個消息泵,這是我通過調用Application.Run()創建: private MyComObj _myComObj;
// Called from Main():
Thread myStaThread = new Thread(() =>
{
_myComObj = new M
當試圖創建WPF用戶控件時,使用myWpfUserControl = new MyWpfUserControl();,WinForm背後的代碼崩潰The calling thread must be STA, because many UI components require this.。它似乎在基礎用戶控件構造函數中崩潰。 我的應用程序的入口點是ApplicationStartup在App.x
我有ASP.NET Web Api項目,我需要使用VB6 COM DLL。我有一個控制器,在那裏我從com創建類的對象,並在我的動作中使用該對象。當我從ca調用該動作時,一切似乎都奏效。 2000-2500線程,但是當我從多個線程運行它,然後我得到這個錯誤在創建COM對象實例: Creating an instance of the COM component with CLSID from th
所以。我正在沿用一些使用WP#F#blog here的教程。 我正在與第二個。 因爲我正在嘗試爲更大型的企業應用程序學習F#WPF,所以使用一堆F#腳本文件對我來說沒有多大意義。所以我試圖將它轉換成一個常規的.fs文件,作爲一種類型,我可以在別處的主要方法中創建一個實例。 namespace wpf
module File1 =
open System
open
我試圖實例化並顯示一個窗口,當我收到一個異常說{"The calling thread must be STA, because many UI components require this."}所以我重新做了一個單獨的STA線程如下所示: var thread = new Thread(() =>
{
notificationPopUp = new NotificationPopU