2010-07-15 3 views
0

Codeplex의 WPF 웹캠 구성 요소의 소스 코드가 .NET 3.5에서 .NET 4.0으로 포팅하려고합니다..NET 4.0에서 WPF 웹캠 구성 요소가 충돌합니다.

은 모두 대상에서 잘 컴파일,하지만이 방법의 라인 moniker.BindToObject(bindCtx, null, ref filterId, out filterObject);에서 System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception와 응용 프로그램을 실행할 때 .NET 4.0 버전에서, 그것은 충돌 : 어떻게 해결하는 이유와

internal static IBaseFilter CreateFilter(string filterMoniker) 
     { 
      object filterObject = null; 
      IBindCtx bindCtx = null; 
      IMoniker moniker = null; 

      int n = 0; 

      if (CreateBindCtx(0, out bindCtx) == 0) 
      { 
       if (MkParseDisplayName(bindCtx, filterMoniker, ref n, out moniker) == 0) 
       { 
        Guid filterId = typeof(IBaseFilter).GUID; 
        try 
        { 
         moniker.BindToObject(bindCtx, null, ref filterId, out filterObject); 
        } 
        catch (Exception ex) 
        { 
         MessageBox.Show(ex+""); 
        } 

        Marshal.ReleaseComObject(moniker); 
       } 
       Marshal.ReleaseComObject(bindCtx); 
      } 
      return filterObject as IBaseFilter; 
     } 

어떤 생각 그것?

카메라는 Genius Eye 110이며 Windows XP SP2에서 작업하고 있습니다.

+0

당신은 당신의 app.config <시작 useLegacyV2RuntimeActivationPolicy = "진정한"> 문자열에 추가하려고 했습니까? –

+0

@Eugene Cheverda app.config에서이 내용을 추가하려고했지만 아직 변경된 사항이 없습니다. 예외가 계속 발생합니다. – luvieere

답변

0

코드를 다운로드하고 4.0으로 컴파일하면 제대로 작동합니다. 당신은 당신의 시스템이 알고있는 웹캠을 가지고 있습니까? 장치 관리자를 확인하여 확인할 수도 있습니다.

카메라가 연결되어 있지 않으면 프로그램에서 사용자의 것과 예외가 발생합니다.

- 매트는

+0

카메라는 연결되어 있고 작동하는 천재성 눈 110입니다. .NET 3.5 SP1에서 컴파일 및 실행되는 반면 4.0에서는 예외가 발생합니다. – luvieere

관련 문제