zoukankan      html  css  js  c++  java
  • winform创建快捷方式

        /// <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);
  • 相关阅读:
    webpack入门+react环境配置
    mailto: HTML e-mail 链接
    IE兼容性手册
    浏览器内核Trident/Gecko/WebKit/Presto
    抓包
    js页面埋点
    http返回码
    meta
    img和css背景的选择
    谈谈Web前端工程师的定位
  • 原文地址:https://www.cnblogs.com/mengxingxinqing/p/3790104.html
Copyright © 2011-2022 走看看