winform创建快捷方式
2014-06-15 22:56
92 查看
/// <summary> /// 创建快捷方式 /// </summary> public class Lnk { /// <summary> /// 创建快捷方式的方法 /// </summary> /// <param name="FolderPath">快捷方式存放的位置</param> /// <param name="PathLink">指向连接的文件</param> /// <param name="LnkName">快捷方式的文件</param> /// <param name="LnkNote">快捷方式的备注</param> /// <param name="IconLocationPath">指定快捷方式的图标</param> public void CreateShortcutLnk(string FolderPath, string PathLink, string LnkName, string LnkNote, string IconLocationPath) { try { WshShell shell = new WshShell(); IWshShortcut Shortcut = (IWshShortcut)shell.CreateShortcut(FolderPath + "\\" + LnkName + ".lnk"); Shortcut.TargetPath = PathLink; Shortcut.WindowStyle = 1; Shortcut.Description = LnkNote; Shortcut.IconLocation = IconLocationPath; Shortcut.Save(); } catch { throw new Exception("出错了,快捷方式未能创建。"); } } }
Lnk CreateLnk = new MagicLibrary.Shortcuts.Lnk(); CreateLnk.CreateShortcutLnk(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), Application.ExecutablePath, "快捷方式", "我的软件", Application.ExecutablePath);
相关文章推荐
- Winform 创建桌面快捷方式并开机启动
- 调用dll给winform程序创建所有用户均可使用的快捷方式
- WinForm 创建Internet快捷方式小工具
- C# WinForm创建包含备注的快捷方式实例
- (转)Winform 创建桌面快捷方式并开机启动
- (转)Winform 创建桌面快捷方式并开机启动
- Winform 创建桌面快捷方式并开机启动
- winform安装项目如何在桌面创建快捷方式
- 创建桌面快捷方式+设置开机启动代码[C#、WinForm]
- C#创建一个文件的快捷方式
- 创建IE快捷方式
- ACCESS 中如何用 WSH 创建桌面快捷方式
- 为WEB程序创建桌面快捷方式^_^
- C#创建快捷方式
- InstallShield 6.2 创建卸载快捷方式
- 如何为java程序创建快捷方式
- 在 .NET 中创建快捷方式 [C#]
- [VC++]如何创建快捷方式 - Web
- InstallShield 6.2 创建卸载快捷方式
- VC创建快捷方式