création de raccourcis (bureau ou menu démarer etc...)
1 réponse
Philippe M
Dans le but de créer un installeur pour faire fonctionner une application,
j'aimerai savoir comment vous arrivez a créer un raccourcis d'un ".exe" via
lignes de code C# pour l'integrer sur le bureau et dans le menu démarer ?
try { // On définit les paramètres du raccourci : WshShell shell = new WshShell(); IWshShortcut link = (IWshShortcut)shell.CreateShortcut( linkPath ); link.TargetPath = exePath; // on pourrait aussi ajouter ici l'icone...etc link.Save();
//ou avec link.Update( } catch { MessageBox.Show("Erreur de création du raccourci " + linkPath, "Shell Link Error",MessageBoxButtons.OK, MessageBoxIcon.Error); }
try
{
// On définit les paramètres du raccourci :
WshShell shell = new WshShell();
IWshShortcut link = (IWshShortcut)shell.CreateShortcut( linkPath );
link.TargetPath = exePath;
// on pourrait aussi ajouter ici l'icone...etc
link.Save();
//ou avec link.Update(
}
catch
{
MessageBox.Show("Erreur de création du raccourci " + linkPath,
"Shell Link Error",MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
try { // On définit les paramètres du raccourci : WshShell shell = new WshShell(); IWshShortcut link = (IWshShortcut)shell.CreateShortcut( linkPath ); link.TargetPath = exePath; // on pourrait aussi ajouter ici l'icone...etc link.Save();
//ou avec link.Update( } catch { MessageBox.Show("Erreur de création du raccourci " + linkPath, "Shell Link Error",MessageBoxButtons.OK, MessageBoxIcon.Error); }