asp.net 桌面快捷方式
2008-05-07 05:43
441 查看
给asp.net项目安装程序添加快捷方式
//添加以下引用:COM 下 Windows Script Host Object Model,然后
//using System.Runtime.InteropServices;
//using IWshRuntimeLibrary;
private void AddShortcut()
{
string[] vPath = this.targetdir.Split('//');
string url = "http://" + this.iis + "/" + vPath[vPath.Length - 2];
try
{
string mysite = url;
//创建收藏夹快捷方式
string fav = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Favorites) + "//MX系统.url";
IWshShell_Class wshShell = new IWshShell_ClassClass();//创建 Windows Script Host Shell 类
IWshURLShortcut favShortcut = wshShell.CreateShortcut(fav) as IWshURLShortcut;//定义快捷方式文件
favShortcut.TargetPath = mysite;
favShortcut.Save();//保存快捷方式
//创建桌面快捷方式
string desktop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "//MX系统.url";
IWshURLShortcut desktopShortcut = wshShell.CreateShortcut(desktop) as IWshURLShortcut;
desktopShortcut.TargetPath = mysite;
desktopShortcut.Save();//保存快捷方式
}
catch (Exception exc)
{
throw new Exception("创建快捷方式错误!" + exc.Message);
}
}
//添加以下引用:COM 下 Windows Script Host Object Model,然后
//using System.Runtime.InteropServices;
//using IWshRuntimeLibrary;
private void AddShortcut()
{
string[] vPath = this.targetdir.Split('//');
string url = "http://" + this.iis + "/" + vPath[vPath.Length - 2];
try
{
string mysite = url;
//创建收藏夹快捷方式
string fav = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Favorites) + "//MX系统.url";
IWshShell_Class wshShell = new IWshShell_ClassClass();//创建 Windows Script Host Shell 类
IWshURLShortcut favShortcut = wshShell.CreateShortcut(fav) as IWshURLShortcut;//定义快捷方式文件
favShortcut.TargetPath = mysite;
favShortcut.Save();//保存快捷方式
//创建桌面快捷方式
string desktop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "//MX系统.url";
IWshURLShortcut desktopShortcut = wshShell.CreateShortcut(desktop) as IWshURLShortcut;
desktopShortcut.TargetPath = mysite;
desktopShortcut.Save();//保存快捷方式
}
catch (Exception exc)
{
throw new Exception("创建快捷方式错误!" + exc.Message);
}
}
相关文章推荐
- 备用:Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- asp.net 桌面快捷方式
- Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)(转帖)
- Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- 备用:Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- Asp.Net-创建网站的快捷方式到桌面,开始菜单,收藏夹
- 备用:Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- asp.net 部署数据库、开始菜单、桌面快捷方式实例
- [转]asp.net 部署数据库、开始菜单、桌面快捷方式实例
- asp.net 实现 桌面快捷方式
- asp.net 桌面快捷方式
- [转]asp.net 部署数据库、开始菜单、桌面快捷方式实例
- asp.net 部署数据库、开始菜单、桌面快捷方式实例
- 备用:Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- asp.net 部署数据库、开始菜单、桌面快捷方式实例(上)
- asp.net 部署数据库、开始菜单、桌面快捷方式实例
- asp.net 部署数据库、开始菜单、桌面快捷方式实例
- asp.net 部署数据库、开始菜单、桌面快捷方式实例(下)
- Asp.Net-创建网站的快捷方式到桌面,开始菜单,收藏夹