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

ASP.NET
asp.net(c#)网页跳转七种方法小结
完美解决在ModalPopupExtender中使用CalendarExtender时被层遮挡的问题
ASP.NET、SharePoint中另存文件的长文件名被截断的原因及解决办法
查看Json输出的*最方便*的方法 (转)
asp.net 代码隐藏的编码模型
ajaxpro.dll 控件实现异步刷新页面
asp.net DbProviderFactory的使用-示例
一个简单的asp.net 单点登录实现
jQuery+Ajax用户登录功能的实现
asp.net 弹出对话框返回多个值
.NET 中英文混合验证码实现代码
一个完整的ASP.NET 2.0 URL重写方案[翻译]
asp.net关于onpropertychange和oninput事件实现代码
asp.net gridview指定某一列滚动
Equals和==的区别 公共变量和属性的区别小结
asp.net 合并GridView中某列相同信息的行(单元格)
ASP.NET(C#) 定时执行一段代码
asp.net 预防SQL注入攻击之我见
asp.net下将Excel转成XML档的实现代码
asp.net url分页类代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 46 ::
收藏到网摘: 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; }