Пример #1
0
 /// <summary>
 /// Creates a new Shortcut instance, recommended for new .lnk files
 /// </summary>
 /// <param name="LnkDestPath">The path where the .lnk file will be created</param>
 public Shortcut(string LnkDestPath)
 {
     this.LnkDestPath = LnkDestPath;
     link             = (NativeMethods.IShellLink) new ShellLink();
     list             = (NativeMethods.IShellLinkDataList)link;
     file             = (IPersistFile)link;
 }
Пример #2
0
 /// <summary>
 /// For Jumplists only
 /// </summary>
 /// <param name="DestPath">JumpList destination</param>
 internal Shortcut(bool JumpList, string DestPath)
 {
     if (JumpList)
     {
         link            = (NativeMethods.IShellLink) new ShellLink();
         list            = (NativeMethods.IShellLinkDataList)link;
         DestinationPath = DestPath;
     }
 }
Пример #3
0
        public ShellLink()
        {
            _link = (NativeMethods.IShellLink) new NativeMethods.CShellLink();

            // Ignore exceptions from the cast. Windows XP doesn't support this
            // interface. Result is that _propertyStore will be null, which we
            // support.

            _propertyStore = _link as NativeMethods.IPropertyStore;
        }
Пример #4
0
        public ShellLink()
        {
            _link = (NativeMethods.IShellLink)new NativeMethods.CShellLink();

            // Ignore exceptions from the cast. Windows XP doesn't support this
            // interface. Result is that _propertyStore will be null, which we
            // support.

            _propertyStore = _link as NativeMethods.IPropertyStore;
        }
Пример #5
0
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (_propertyStore != null)
                {
                    Marshal.FinalReleaseComObject(_propertyStore);
                    _propertyStore = null;
                }

                if (_link != null)
                {
                    Marshal.FinalReleaseComObject(_link);
                    _link = null;
                }

                _disposed = true;
            }
        }
Пример #6
0
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (_propertyStore != null)
                {
                    Marshal.FinalReleaseComObject(_propertyStore);
                    _propertyStore = null;
                }

                if (_link != null)
                {
                    Marshal.FinalReleaseComObject(_link);
                    _link = null;
                }

                _disposed = true;
            }
        }