Пример #1
0
 public static void Create(String PathToFile, String PathToLink, String Arguments, String Description)
 {
     ShellLink.IShellLinkW shlLink = ShellLink.CreateShellLink();
     Marshal.ThrowExceptionForHR(shlLink.SetDescription(Description));
     Marshal.ThrowExceptionForHR(shlLink.SetPath(PathToFile));
     Marshal.ThrowExceptionForHR(shlLink.SetArguments(Arguments));
     ((System.Runtime.InteropServices.ComTypes.IPersistFile)shlLink).Save(PathToLink, false);
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        public static void Create(
            string PathToFile, string PathToLink,
            string Arguments, string Description)
        {
            ShellLink.IShellLinkW shlLink = ShellLink.CreateShellLink();

            Marshal.ThrowExceptionForHR(shlLink.SetDescription(Description));
            Marshal.ThrowExceptionForHR(shlLink.SetPath(PathToFile));
            Marshal.ThrowExceptionForHR(shlLink.SetArguments(Arguments));
            //Marshal.ThrowExceptionForHR(shlLink.SetIconLocation(@"C:\Users\Ракета\Desktop\594214.ico", 21));

            ((System.Runtime.InteropServices.ComTypes.IPersistFile)shlLink).Save(PathToLink, false);
        }