ScreenToGif.Webcam.DirectX.Filter.GetName C# (CSharp) Method

GetName() protected method

Retrieve the human-readable name of the filter
protected GetName ( UCOMIMoniker moniker ) : string
moniker UCOMIMoniker
return string
        protected string GetName(UCOMIMoniker moniker)
        {
            object bagObj = null;
            IPropertyBag bag = null;

            try
            {
                Guid bagId = typeof(IPropertyBag).GUID;
                moniker.BindToStorage(null, null, ref bagId, out bagObj);
                bag = (IPropertyBag)bagObj;
                object val = "";
                int hr = bag.Read("FriendlyName", ref val, IntPtr.Zero);

                if (hr != 0)
                    Marshal.ThrowExceptionForHR(hr);

                var ret = val as string;

                if (string.IsNullOrEmpty(ret))
                    throw new NotImplementedException("Device FriendlyName");
                return (ret);
            }
            catch (Exception)
            {
                return ("");
            }
            finally
            {
                bag = null;
                if (bagObj != null)
                    Marshal.ReleaseComObject(bagObj); bagObj = null;
            }
        }

Same methods

Filter::GetName ( string monikerString ) : string