private void Initialize()
        {
            object factoryObject = null;
            object managerObject = null;

            try
            {
                var hr = ClassFactory.GetEvrPresenterClassFactory(ref CLSID_MediaWindowManager, ref ClassFactory.IID_ClassFactory, out factoryObject);
                Marshal.ThrowExceptionForHR(hr);

                var factory = (IClassFactory)factoryObject;

                var iidMediaWindow = typeof(IEvrPresenterMediaWindowManager).GUID;
                hr = factory.CreateInstance(null, ref iidMediaWindow, out managerObject);
                Marshal.ThrowExceptionForHR(hr);

                _manager      = (IEvrPresenterMediaWindowManager)managerObject;
                managerObject = null;

                Marshal.ThrowExceptionForHR(_manager.GetMediaWindow(out _hMediaWindow));
            }
            finally
            {
                if (factoryObject != null)
                {
                    Marshal.FinalReleaseComObject(factoryObject);
                }

                if (managerObject != null)
                {
                    Marshal.FinalReleaseComObject(managerObject);
                }
            }
        }
 private void Dispose(bool disposing)
 {
     if (disposing && _manager != null)
     {
         Marshal.FinalReleaseComObject(_manager);
         _manager = null;
     }
 }