• 230 阅读
  • 2 回复

添加网页桌面快捷方式的代码

视频在线上传+队列转换FLV+水印+捉图+修复+获时+转3GP(API语言不限,开视频站必备!)

JS代码
function toDesktop(sUrl,sName){
   try{
       var WshShell = new ActiveXObject("WScript.Shell");
       var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url");
       oUrlLink.TargetPath = sUrl;
       oUrlLink.Save();
   }catch(e){  
       alert("当前IE安全级别不允许操作!");  
   }
}

<a href="javascript:void(0);" onclick="toDesktop('http:\//www.163.com/','163网易')">创建快捷方式</a>
asp代码


<%
   title="郑州简悦信息技术有限公司url"
   Shortcut = "[InternetShortcut] " & vbCrLf
   Shortcut = Shortcut & "URL=http://www.uzuz8.net" & vbCrLf
   Shortcut = Shortcut & "IDList= " & vbCrLf
   Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}] " & vbCrLf
   Shortcut = Shortcut & "Prop3=19,2 " & vbCrLf
   Shortcut = Shortcut & " " & vbCrLf
   Response.AddHeader "Content-Disposition", "attachment;filename="&title&".url;"
   Response.ContentType = "application/octet-stream"
   Response.Write Shortcut
%>



代码 复制 - 运行

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

  

public partial class CreateShortcut : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

     {

     }

 

     /// <summary>

     /// 创建快捷方式

     /// </summary>

     /// <param name="Title">标题</param>

     /// <param name="URL">URL地址</param>

     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);

  

     }

  

     /// <summary>

     /// 创建快捷方式

     /// </summary>

     /// <param name="Title">标题</param>

     /// <param name="URL">URL地址</param>

     /// <param name="SpecialFolder">特殊文件夹</param>

     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 btnShortcut_Click(object sender, System.EventArgs e)

     {

         CreateShortcut("郑州简悦信息技术有限公司", http://www.uzuz8.net);

     }

 }





https://www.cnblogs.com/chendaoyin/archive/2012/12/27/2835297.html
小鱼的淘宝店铺-多多支持哇
视频在线上传+队列转换FLV+水印+捉图+修复+获时+转3GP(API语言不限,开视频站必备!)

鱼整:

代码 复制 - 运行

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DTcms.Web.test
{
    public partial class shortcut : System.Web.UI.Page
    {
        /// <summary>
        /// https://www.cnblogs.com/chendaoyin/archive/2012/12/27/2835297.html
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            CreateShortcut("郑州简悦信息技术有限公司", "http://www.uzuz8.net");
        }

        /// <summary>
        /// 创建快捷方式
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="URL">URL地址</param>
        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);

        }

        /// <summary>
        /// 创建快捷方式
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="URL">URL地址</param>
        /// <param name="SpecialFolder">特殊文件夹</param>
        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();
        }
    }
}
小鱼的淘宝店铺-多多支持哇
视频在线上传+队列转换FLV+水印+捉图+修复+获时+转3GP(API语言不限,开视频站必备!)
参 http://bbs.dtcms.net/forum.php?mod=viewthread&tid=1352&extra=page%3D2
小鱼的淘宝店铺-多多支持哇