Posted By

delm on 08/17/09


Tagged

shortcut lnk


Versions (?)

Crear acceso directo


 / Published in: C
 

URL: http://www.eggheadcafe.com/community/aspnet/14/26241/here-is-how-to-do-it-usin.aspx

Se requiere hacer referencia a la dll Interop.IWshRuntimeLibrary.

  1. using IWshRuntimeLibrary;
  2.  
  3. ...
  4.  
  5. public static void CreateShortcut(string linkFilename, string description, string targetPath, string iconLocation, int iconIndex)
  6. {
  7. IWshShortcut_Class shortcut = (IWshShortcut_Class)new IWshShell_ClassClass().CreateShortcut(linkFilename);
  8. shortcut.Description = description;
  9. shortcut.TargetPath = targetPath;
  10. shortcut.IconLocation = iconLocation + "," + iconIndex;
  11. shortcut.Save();
  12. }
  13.  
  14. ...
  15.  
  16. Call that method like this:
  17.  
  18. CreateShortcut(linkFilename, description, targetPath, targetPath, 0);

Report this snippet  

You need to login to post a comment.