创建IE快捷方式

2005-06-16   作者:佚名   来源:本站整理   浏览:11857   评论:0
/// ============?? SpecialFolder ============
///
/// ApplicationData? ??@"C:\Documents and Settings\whj\Application Data"
/// CommonApplicationData?@"C:\Documents and Settings\All Users\Application Data"
/// CommonProgramFiles??@"C:\Program Files\Common Files"
/// Cookies?????@"C:\Documents and Settings\whj\Cookies"
/// Desktop?????@"C:\Documents and Settings\whj\桌面"
/// DesktopDirectory??@"C:\Documents and Settings\whj\桌面"
/// Favorites????@"C:\Documents and Settings\whj\Favorites"
/// History?????@"C:\Documents and Settings\whj\Local Settings\History"
/// InternetCache???@"C:\Documents and Settings\whj\Local Settings\Temporary Internet Files"
/// LocalApplicationData?@"C:\Documents and Settings\whj\Local Settings\Application Data"
/// MyComputer
/// MyMusic
/// MyPictures????@"C:\Documents and Settings\whj\My Documents\My Pictures"
/// Personal????@"C:\Documents and Settings\whj\My Documents"
/// ProgramFiles???@"C:\Program Files"
/// Programs????@"C:\Documents and Settings\whj\「开始」菜单\程序"
/// Recent?????@"C:\Documents and Settings\whj\Recent"
/// SendTo?????@"C:\Documents and Settings\whj\SendTo"
/// StartMenu????@"C:\Documents and Settings\whj\「开始」菜单"
/// Startup?????@"C:\Documents and Settings\whj\「开始」菜单\程序\启动"
/// System?????@"C:\WINNT\system32"
/// Templates????@"C:\Documents and Settings\whj\Templates"

private void CreateShortcut(string Title , string URL)
{
?string strFavoriteFolder ;

?// “收藏夹”中 创建 IE 快捷方式
?strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
?CreateShortcutFile(Title,URL,strFavoriteFolder);

?// “ 桌面 ”中 创建 IE 快捷方式
?strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
?CreateShortcutFile(Title,URL,strFavoriteFolder);

?// “ 链接 ”中 创建 IE 快捷方式
?strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites)+"\\链接";
?CreateShortcutFile(Title,URL,strFavoriteFolder);

?//「开始」菜单中 创建 IE 快捷方式
?strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
?CreateShortcutFile(Title,URL,strFavoriteFolder);
?
}

private void CreateShortcutFile(string Title , string URL, string SpecialFolder)
{
?// Create shortcut file, based on Title
?System.IO.StreamWriter objWriter = System.IO.File.CreateText(SpecialFolder + "\\" + Title + ".url" );
?// Write URL to file
?objWriter.WriteLine("[InternetShortcut]");
?objWriter.WriteLine("URL=" + URL);
?// Close file
?objWriter.Close();
}

??private void button1_Click(object sender, System.EventArgs e)
??{
???CreateShortcut("TestIEShortCut","http://blog.csdn.net/LuckyJan/");
??}
Tags:责任编辑:cvery
顶一下(58)
76.32%

网友评论已有 0 人参与评论  

请自觉遵守互联网相关政策法规,评论内容只代表网友观点,与本站立场无关!
  验证码:     登录   注册