2011-12-11 62 views
0

我在Windows Server 2008上使用Visual Studio 2010在C#中構建應用程序,應用程序是使用directshownet直接顯示在.NET包裝程序來訪問系統的Web攝像頭讓視頻流,但應用程序生成此錯誤檢索具有CLSID {C1F400A0-3F08-11D3-9F0B-006008039E37}的組件的COM類工廠失敗,原因是出現以下錯誤:80040154

Retrieving the COM class factory for component with CLSID {C1F400A0-3F08-11D3-9F0B-006008039E37} failed due to the following error: 80040154. 

源代碼如下

public Capture(int iDeviceNum, int iWidth, int iHeight, short iBPP, Control hControl) 
    { 
     DsDevice[] capDevices; 
     // Get the collection of video devices 
     capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); 
     if (iDeviceNum + 1 > capDevices.Length) 
     { 
      throw new Exception("No video capture devices found at that index!"); 
     } 
     try 
     { 

      // Set up the capture graph 
      SetupGraph(capDevices[iDeviceNum], iWidth, iHeight, iBPP); 
      //// tell the callback to ignore new images 
      m_PictureReady = new ManualResetEvent(false); 
     } 
     catch 
     { 
      Dispose(); 
      throw; 
     } 
    } 

的代碼拋出每當它到達這條線時的錯誤

SetupGraph(capDevices[iDeviceNum], iWidth, iHeight, iBPP); 

請人幫助我,我用Google搜索,但無法找到一個解決方案

+0

嗨, 您收到的COM錯誤是「Class Not Registered」錯誤。這可能有很多原因tbh;但一些常見的是: - COM對象確實未註冊,因此無法創建 - COM對象具有其他不可用的依賴項。 - 混合64位和32位要求(.Net 64位,32位COM組件)。 –

+0

謝謝,我已經能夠解決這個問題,它像directshow.net需要一個不在我的Windows服務器上的qedit.dll,我下載了DLL並使用了regsvr32來註冊,並且我停止接收錯誤 –

回答

0

你可能想嘗試顯式編譯項目的x86模式,而不是任何看看是否能解決問題。也有可能你的機器上缺少一個必需的DLL。

+0

編譯是在x86模式下,它仍然給出相同的錯誤 –

1

該guid與名爲"Sample Grabber"的捕獲設備相關聯。它在名爲qedit.h的SDK標頭中聲明,docs are here。請注意棄用警告,qedit.h不再是Windows SDK的一部分,我沒有在Windows 7機器上安裝它。

聽起來好像你有輕微的註冊表損壞情況,可能是由Windows升級引起的。採樣採樣器仍然作爲一個設備登記,但實際的過濾器不再註冊。不知道如何解決這個問題,請到superuser.com諮詢。然而,這些不幸事件也可能發生在用戶的機器上。是否捕獲異常並繼續尋找另一個可用的捕獲設備。

+0

感謝您的時間 –

相關問題