Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }