2011-12-11 84 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

感谢您的时间 –

相关问题