Exemplo n.º 1
0
 internal PropertyStore(ShellLink lnk, EventHandler propChangedHandler = null)
 {
     iprops = (IPropertyStore)lnk.link;
     if (propChangedHandler != null)
     {
         PropertyChanged += propChangedHandler;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates or overwrites a new link file.
        /// </summary>
        /// <param name="linkFilename">The link filename.</param>
        /// <param name="targetFilename">The full path to the target file.</param>
        /// <param name="description">The description of the link.</param>
        /// <param name="workingDirectory">The working directory for the execution of the target.</param>
        /// <param name="arguments">The arguments for the target's execution.</param>
        /// <returns>An instance of a <see cref="ShellLink"/> representing the values supplied.</returns>
        public static ShellLink Create(string linkFilename, string targetFilename, string description = null,
                                       string workingDirectory = null, string arguments = null)
        {
            var lnk = new ShellLink
            {
                TargetPath       = targetFilename,
                Description      = description,
                WorkingDirectory = workingDirectory,
                Arguments        = arguments
            };

            lnk.SaveAs(linkFilename);
            return(lnk);
        }