当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 关于创建快捷方式的小结

ASP.NET
合理的网盟广告策略:如何规划与投放网盟广告
GoDaddy Backorder域名抢注经验分享
Google Analytics获得GOOGLE真正的收录网站数据指标
Visual Studio 2008 Team Suite简体中文正式版- 激活方法

ASP.NET 中的 关于创建快捷方式的小结


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 34 ::
收藏到网摘: n/a


因为要用到这方面的东东,所以小结了一下,如下:
/// /// 创建文件的快捷方式(虚拟路径) /// ///
目标位置
///
目标
private void CreateShortCut(string Path,string TargetPath) { if(System.IO.File.Exists(@TargetPath)) { Path += @".lnk"; IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass(); IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(@Path); shortcut.TargetPath = @TargetPath; shortcut.Save(); } }
/// /// 把虚拟的快捷方式路径转化为物理路径 /// ///
虚拟路径
/// 物理路径 如果为空字符窜则该虚拟路径不存在或者输入的不是虚拟路径 private string ConvertToPhysicalPath(string Path) { string targetPath=""; Path += @".lnk"; if(System.IO.File.Exists(@Path)) { IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass(); IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(@Path); targetPath = shortcut.TargetPath; } return targetPath; }