/// <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; }
/// <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; } }
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; }
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; }
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; } }