Added create shortcut function

This commit is contained in:
Alexander 2018-12-09 16:10:44 +02:00
parent c45c52cca2
commit e442c1888c

View file

@ -254,6 +254,23 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
}
}
#region Send to Shortcut
public static void SendToShortcut()
{
string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\SendTo";
string shortcutName = "Crypto Notepad" + ".lnk";
string shortcutLocation = Path.Combine(shortcutPath, shortcutName);
string targetFileLocation = Assembly.GetEntryAssembly().Location;
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
shortcut.Description = "Crypto Notepad";
shortcut.IconLocation = targetFileLocation;
shortcut.TargetPath = targetFileLocation;
shortcut.Save();
}
#endregion
private void MainWindow_Load(object sender, EventArgs e)
{
string pos = ps.WindowLocation.ToString();