Overblog Tous les blogs Top blogs Économie, Finance & Droit Tous les blogs Économie, Finance & Droit
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU

Cycle de progression Faire (quelque chose qui marche) -> comprendre ce que l’on fait/comment cela marche -> pousser plus loin les notions

Publicité

Snippet - Créer un raccourci sur le bureau

Créer un raccourci sur le bureau
 
Ajouter un référence à IWshRuntimeLibrary (située C:WINDOWSsystem32wshom.ocx)
private void CreateShortCut(string fileName)
        {
            string Desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            WshShell oWshShell = new WshShell();
            IWshShortcut oIWshShortcut = (IWshShortcut)oWshShell.CreateShortcut(Path.Combine(Desktop, Path.GetFileNameWithoutExtension(fileName) + ".lnk"));
            oIWshShortcut.TargetPath = fileName; 
            oIWshShortcut.Save();
        }
 
Utilisation :
CreateShortCut(« C:/Documents and Settings/romagny/Mes documents/monapplication.exe »);
Publicité
Retour à l'accueil
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article