我正在使用 Visual Studio 制作一个 Windows 窗体应用程序。该应用程序允许您输入照片的名称,然后将该图像保存到网络上的特定位置。当我在笔记本电脑上使用它时,效果非常好。但是,当我尝试在桌面上运行它时,它不起作用。相反,我收到消息:
System.Runtime.InteropServices.COMException(0x80040217):否
可以找到中间过滤器的组合来使
联系。
在 DirectShowLib.DsError.ThrowExceptionForHR(Int32 小时)
在 OrderProductCapture.Capture.SetupGraph(DsDevice dev, Int32 iWidth,
Int32 iHeight、Int16 iBPP、控制 hControl)
在 OrderProductCapture.Capture.ctor(Int32 iDeviceNum, Int32 iWidth,
Int32 iHeight、Int16 iBPP、控制 hControl)
在 OrderProductCapture.frmMain.ctor()
调用堆栈说:
OrderProductCapture.exe!OrderProductCapture.Capture(int iDeviceNum, int iWidth, int iHeight, short iBPP, System.Windows.Forms.Control hControl) Line 82
OrderProductCapture.exe!OrderProductCapture.frmMain.frmMain() Line 50
OrderProductCapture.exe!OrderProductCapture.Program.Main() Line 19
我已经在谷歌上搜索过很多次了,并且我已经查看了大多数类似的问题。两台电脑均使用Windows 7专业版。任何帮助都会很棒。
这是我的代码捕获异常的代码。我不认为代码是错误的,因为它在我的笔记本电脑上运行良好。
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, hControl);
// tell the callback to ignore new images
m_PictureReady = new ManualResetEvent(false);
}
catch
{
Dispose();
throw;
}
}