Exemple #1
0
 public void Dispose()
 {
     if (iWmpEffects != null)
     {
         DirectShowUtil.ReleaseComObject(iWmpEffects);
         iWmpEffects = null;
     }
 }
    internal WMPVisualizationPlugin(string sClsid)
    {
      Guid g;
      Object oCom = null;
      bool isValidVizObject = false;

      try
      {
        g = new Guid(sClsid);

        Type comObjType = Type.GetTypeFromCLSID(g);
        oCom = Activator.CreateInstance(comObjType);

        // Cast of IWMPEffects
        iWmpEffects = oCom as IWMPEffects;

        if (iWmpEffects != null)
        {
          // supports the interface IWMPEffects > IWmpEffects2 ?
          iWmpEffects2 = oCom as IWMPEffects2;

          if (iWmpEffects2 != null)
          {              
            // the interface IWmpEffects2 is supported, need
            // we the interface IWmpEffects no longer.  
            iWmpEffects = null;
            isValidVizObject = true;
          }
        }
      }

      catch (FormatException)
      {
        isValidVizObject = false;
      }

      catch (COMException)
      {
        isValidVizObject = false;
      }

      catch (NullReferenceException)
      {
        isValidVizObject = false;
      }

      if (!isValidVizObject || oCom == null)
      {
        if (oCom != null)
        {
          DirectShowUtil.ReleaseComObject(oCom);
        }
        iWmpEffects = null;
        iWmpEffects2 = null;
        throw new Exception("Object is not a IWMPEffects or IWMPEffects2 interface!");
      }
    }
        internal WMPVisualizationPlugin(string sClsid)
        {
            Guid   g;
            Object oCom             = null;
            bool   isValidVizObject = false;

            try
            {
                g = new Guid(sClsid);

                Type comObjType = Type.GetTypeFromCLSID(g);
                oCom = Activator.CreateInstance(comObjType);

                // Cast of IWMPEffects
                iWmpEffects = oCom as IWMPEffects;

                if (iWmpEffects != null)
                {
                    // supports the interface IWMPEffects > IWmpEffects2 ?
                    iWmpEffects2 = oCom as IWMPEffects2;

                    if (iWmpEffects2 != null)
                    {
                        // the interface IWmpEffects2 is supported, need
                        // we the interface IWmpEffects no longer.
                        iWmpEffects      = null;
                        isValidVizObject = true;
                    }
                }
            }

            catch (FormatException)
            {
                isValidVizObject = false;
            }

            catch (COMException)
            {
                isValidVizObject = false;
            }

            catch (NullReferenceException)
            {
                isValidVizObject = false;
            }

            if (!isValidVizObject || oCom == null)
            {
                if (oCom != null)
                {
                    DirectShowUtil.ReleaseComObject(oCom);
                }
                iWmpEffects  = null;
                iWmpEffects2 = null;
                throw new Exception("Object is not a IWMPEffects or IWMPEffects2 interface!");
            }
        }
Exemple #4
0
        internal WMPVisualizationPlugin(string sClsid)
        {
            Guid   g;
            Object oCom             = null;
            bool   isValidVizObject = false;

            try
            {
                g = new Guid(sClsid);

                Type comObjType = Type.GetTypeFromCLSID(g);
                oCom = Activator.CreateInstance(comObjType);

                if (oCom != null)
                {
                    iWmpEffects      = (IWMPEffects)oCom;
                    isValidVizObject = true;
                }
            }

            catch (FormatException)
            {
                isValidVizObject = false;
            }

            catch (COMException)
            {
                isValidVizObject = false;
            }

            catch (NullReferenceException)
            {
                isValidVizObject = false;
            }

            if (!isValidVizObject || oCom == null)
            {
                if (oCom != null)
                {
                    DirectShowUtil.ReleaseComObject(oCom);
                }
                iWmpEffects = null;
                throw new Exception("Object is not a IWMPEffects interface!");
            }
        }
    internal WMPVisualizationPlugin(string sClsid)
    {
      Guid g;
      Object oCom = null;
      bool isValidVizObject = false;

      try
      {
        g = new Guid(sClsid);

        Type comObjType = Type.GetTypeFromCLSID(g);
        oCom = Activator.CreateInstance(comObjType);

        if (oCom != null)
        {
          iWmpEffects = (IWMPEffects)oCom;
          isValidVizObject = true;
        }
      }

      catch (FormatException)
      {
        isValidVizObject = false;
      }

      catch (COMException)
      {
        isValidVizObject = false;
      }

      catch (NullReferenceException)
      {
        isValidVizObject = false;
      }

      if (!isValidVizObject || oCom == null)
      {
        if (oCom != null)
        {
          DirectShowUtil.ReleaseComObject(oCom);
        }
        iWmpEffects = null;
        throw new Exception("Object is not a IWMPEffects interface!");
      }
    }
    public void Dispose()
    {
      if (iWmpEffects != null)
      {
        DirectShowUtil.ReleaseComObject(iWmpEffects);
        iWmpEffects = null;
      }

      if (iWmpEffects2 != null)
      {
        DirectShowUtil.ReleaseComObject(iWmpEffects2);
        iWmpEffects2 = null;
      }
    }