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", ""); } } }
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", ""); } } } }