예제 #1
0
        private IShellLink Create()
        {
            var l = Create(this.Target, this.Arguments, this.Description, this.Icon);

            try
            {
                var ps = (WindowProperties.IPropertyStore)l;

                if (this.PreventPinning)
                {
                    using (var pv = new WindowProperties.PropVariant(true))
                    {
                        var pk = WindowProperties.PropertyKey.AppUserModel_PreventPinning;
                        ps.SetValue(ref pk, pv);
                    }
                }

                if (!string.IsNullOrEmpty(this.AppUserModelID))
                {
                    using (var pv = new WindowProperties.PropVariant(this.AppUserModelID))
                    {
                        var pk = WindowProperties.PropertyKey.AppUserModel_ID;
                        ps.SetValue(ref pk, pv);
                    }
                }
            }
            catch (Exception e)
            {
                Util.Logging.Log(e);
            }

            return(l);
        }
예제 #2
0
 public static string GetTitle(Shortcut.IShellLink link)
 {
     try
     {
         var ps = (WindowProperties.IPropertyStore)link;
         using (var pv = new WindowProperties.PropVariant())
         {
             ps.GetValue(ref PKEY_Title, pv);
             return((string)pv.GetValue());
         }
     }
     catch (Exception e)
     {
         Util.Logging.Log(e);
     }
     return("");
 }