码迷,mamicode.com
首页 > 其他好文 > 详细

安装包创建桌面快捷方式

时间:2015-01-22 12:29:11      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:


private void CreateDesktop() { string path = this.Context.Parameters["targetdir"]; path = path.Substring(0, path.LastIndexOf("/")); if (!System.IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "//" + "微信打印机.lnk")) { WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "//" + "微信打印机.lnk" ); shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location; shortcut.WorkingDirectory = System.Environment.CurrentDirectory; shortcut.WindowStyle = 1; //Normal window shortcut.Description = "微信打印机"; shortcut.IconLocation = path + "ico//desktop.ico"; shortcut.Save(); } }

 

安装包创建桌面快捷方式

标签:

原文地址:http://www.cnblogs.com/Iyce/p/4241082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!