Beispiel #1
0
        /// <summary>
        /// 创建桌面快捷方式
        /// </summary>
        /// <param name="targetPath">可执行文件路径</param>
        /// <param name="description">快捷方式名称</param>
        /// <param name="iconLocation">快捷方式图标路径</param>
        /// <param name="workingDirectory">工作路径</param>
        /// <returns></returns>

        public static bool CreateDesktopShortcut(string targetPath, string description, string iconLocation, string workingDirectory)
        {
            if (string.IsNullOrEmpty(workingDirectory))
            {
                workingDirectory = ShortCutHelper.GetDeskDir();
            }
            return(ShortCutHelper.CreateShortcut(ShortCutHelper.GetDeskDir() + "\\" + description + ".lnk", targetPath, workingDirectory, description, iconLocation));
        }
Beispiel #2
0
 private void tsmiCreateShortCutOnUtil_Click(object sender, EventArgs e)
 {
     if (lvUtilSofeware.SelectedItems.Count > 0)
     {
         string exePath       = lvUtilSofeware.SelectedItems[0].Tag.ToString();
         string sFilename     = exePath;
         string sFile         = DirFile.GetFileNameNoExtension(sFilename);
         string sShortcutPath = ShortCutHelper.GetDeskDir() + "\\" + sFile + ".lnk";
         if (!System.IO.File.Exists(sShortcutPath))
         {
             string sWorkPath = DirFile.GetLastDirectory(sFilename);
             //创建快捷键
             ShortCutHelper.CreateShortcut(sShortcutPath, sFilename, sWorkPath, "Make In IRunner", "");
         }
     }
 }
Beispiel #3
0
 private void tsmiCreateShortCut_Click(object sender, EventArgs e)
 {
     if (mouseDownOnListview != Point.Empty)
     {
         ListViewHitTestInfo info = lvStartMenu.HitTest(mouseDownOnListview.X, mouseDownOnListview.Y);
         if (info.Item != null && info.Item.Group != null)
         {
             string sFilename     = info.Item.Tag.ToString();
             string sFile         = DirFile.GetFileNameNoExtension(sFilename);
             string sShortcutPath = ShortCutHelper.GetDeskDir() + "\\" + sFile + ".lnk";
             if (!System.IO.File.Exists(sShortcutPath))
             {
                 string sWorkPath = DirFile.GetLastDirectory(sFilename);
                 //创建快捷键
                 ShortCutHelper.CreateShortcut(sShortcutPath, sFilename, sWorkPath, "Make In IRunner", "");
             }
         }
     }
 }