C#创建快捷方式
2007-11-29 09:23
302 查看
先添加IWshRuntimeLibrary引用
// Create a new instance of WshShellClass
WshShellClass WshShell = new WshShellClass();
// Create the shortcut
IWshRuntimeLibrary.IWshShortcut MyShortcut;
// Choose the path for the shortcut
MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(@"C:/MyShortcut.lnk");
// Where the shortcut should point to
MyShortcut.TargetPath = Application.ExecutablePath;
// Description for the shortcut
MyShortcut.Description = "Launch My Application";
// Location for the shortcut's icon
MyShortcut.IconLocation = Application.StartupPath + @"/App.ico";
// Create the shortcut at the given path
MyShortcut.Save();
示例源码下载 http://download.csdn.net/source/297466
// Create a new instance of WshShellClass
WshShellClass WshShell = new WshShellClass();
// Create the shortcut
IWshRuntimeLibrary.IWshShortcut MyShortcut;
// Choose the path for the shortcut
MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(@"C:/MyShortcut.lnk");
// Where the shortcut should point to
MyShortcut.TargetPath = Application.ExecutablePath;
// Description for the shortcut
MyShortcut.Description = "Launch My Application";
// Location for the shortcut's icon
MyShortcut.IconLocation = Application.StartupPath + @"/App.ico";
// Create the shortcut at the given path
MyShortcut.Save();
示例源码下载 http://download.csdn.net/source/297466
相关文章推荐
- c# 纯代码方式创建快捷方式
- C#创建快捷方式与添加网页到收藏夹
- C#创建快捷方式
- C#两种创建快捷方式的方法
- 用C# 创建快捷方式
- C#创建桌面快捷方式 和 开机启动
- 在 .NET 中创建快捷方式 [C#]
- 在 .NET 中创建快捷方式 [C#]
- C#创建桌面快捷方式
- 如何使用C#操作快捷方式(获取快捷方式属性、创建快捷方式)
- 【转】在C#2005中创建快捷方式
- C#创建快捷方式
- 如何使用C#代码创建快捷方式文件详解
- C# 创建快捷方式
- C#如何编程在桌面创建快捷方式
- 创建桌面快捷方式+设置开机启动代码[C#、WinForm]
- C# 创建一个application的桌面快捷方式
- c#通过纯代码创建桌面快捷方式、创建程序菜单项、将网页添加到收藏夹
- C#创建一个文件的快捷方式
- C#入门学习-----菜单应用(添加剂快捷方式、设置菜单项是否可用、修改菜单字体、创建级联菜单、级联菜单的动态合并)