public static void Create(string PathToFile, string PathToLink, string Arguments, string Description, bool floder) { ShellLink.IShellLinkW shlLink = ShellLink.CreateShellLink(); Marshal.ThrowExceptionForHR(shlLink.SetDescription(Description)); Marshal.ThrowExceptionForHR(shlLink.SetPath(PathToFile)); Marshal.ThrowExceptionForHR(shlLink.SetArguments(Arguments)); Marshal.ThrowExceptionForHR(shlLink.SetIconLocation("%SystemRoot%\\System32\\SHELL32.dll", floder ? 4 : 0)); ((System.Runtime.InteropServices.ComTypes.IPersistFile)shlLink).Save(PathToLink, false); }
public static void Create(string filePath, string linkPath, string args, string descr, bool dir) { ShellLink.IShellLinkW shlLink = ShellLink.CreateShellLink(); Marshal.ThrowExceptionForHR(shlLink.SetDescription(descr)); Marshal.ThrowExceptionForHR(shlLink.SetPath(filePath)); Marshal.ThrowExceptionForHR(shlLink.SetArguments(args)); Marshal.ThrowExceptionForHR(shlLink.SetIconLocation("%SystemRoot%\\System32\\SHELL32.dll", dir ? 4 : 0)); ((System.Runtime.InteropServices.ComTypes.IPersistFile)shlLink).Save(linkPath, false); }
public static void Create( string PathToFile, string PathToLink, string Arguments, string Iconpath, int IconNum) { ShellLink.IShellLinkW shlLink = ShellLink.CreateShellLink(); Marshal.ThrowExceptionForHR(shlLink.SetPath(PathToFile)); Marshal.ThrowExceptionForHR(shlLink.SetArguments(Arguments)); Marshal.ThrowExceptionForHR(shlLink.SetIconLocation(Iconpath, IconNum)); ((System.Runtime.InteropServices.ComTypes.IPersistFile)shlLink).Save(PathToLink, false); }