예제 #1
0
        private static void createShortCut(ShortCutProperties pShortcut, string pShortcutPath)
        {
            WshShellClass shellClass = new WshShellClass();
            IWshShortcut  workingShortCut;

            // Shortcuts erzeugen
            workingShortCut              = (IWshRuntimeLibrary.IWshShortcut)shellClass.CreateShortcut(pShortcutPath);
            workingShortCut.TargetPath   = @pShortcut.TargetPath;
            workingShortCut.Description  = pShortcut.Description;
            workingShortCut.IconLocation = @pShortcut.IconPath;
            workingShortCut.Save();
        }
예제 #2
0
        /// <summary>
        /// Erstellt einen neuen Ordner im Startmenü und legt darin die übergebenen Icons ab.
        /// </summary>
        /// <param name="pShortCuts">Abzulegende Icon-Eigenschaften</param>
        /// <param name="pFolderName">Name des Ordners im Startmenü</param>
        /// <param name="pCommon">Startmenü für alle Nutzer anlegen? (aktueller User = false)</param>
        public static void CreateStartMenuEntry(ShortCutProperties[] pShortCuts, string pFolderName, bool pCommon)
        {
            string startMenuDir;

            // Ordnerpfad ermitteln
            if(pCommon)
            {
                startMenuDir = TBL.OperatingSystem.GetMenuPathCommon();
            }
            else
            {
                startMenuDir = TBL.OperatingSystem.GetMenuPathCurrentUser();
            }

            if(pFolderName != "")
            {
                startMenuDir = System.IO.Path.Combine(startMenuDir, pFolderName);

                // Anlegen
                try
                {
                    System.IO.Directory.CreateDirectory(startMenuDir);
                }
                catch
                {
                    // TODO throw zugriffsverletzungsexception

                }
            }

            foreach(ShortCutProperties s in pShortCuts)
            {
                string shortcutPath = startMenuDir + @"\" + s.Name + ".lnk";
                createShortCut(s, shortcutPath);
            }
        }
예제 #3
0
        private static void createShortCut(ShortCutProperties pShortcut, string pShortcutPath)
        {
            WshShellClass shellClass = new WshShellClass();
            IWshShortcut workingShortCut;

            // Shortcuts erzeugen
            workingShortCut = (IWshRuntimeLibrary.IWshShortcut) shellClass.CreateShortcut(pShortcutPath);
            workingShortCut.TargetPath = @pShortcut.TargetPath;
            workingShortCut.Description = pShortcut.Description;
            workingShortCut.IconLocation = @pShortcut.IconPath;
            workingShortCut.Save();
        }
예제 #4
0
 /// <summary>
 /// Legt beliebig viele Desktopicons an
 /// </summary>
 /// <param name="pShortCuts">Shortcut-Array vom Typ <see cref="ShortCutProperties">ShortCutProperties</see></param>
 public static void CreateDesktopIcons(ShortCutProperties[] pShortCuts)
 {
     foreach(ShortCutProperties s in pShortCuts)
     {
         string shortcutPath = TBL.OperatingSystem.DesktopDirectory + @"\" + s.Name + ".lnk";
         createShortCut(s, shortcutPath);
     }
 }