zoukankan      html  css  js  c++  java
  • 创建桌面快捷方式的语法

    转载文章:创建桌面快捷方式语法:

    //实例化WshShell对象 
    WshShell shell = new WshShell();
    
    //通过该对象的 CreateShortcut 方法来创建 IWshShortcut 接口的实例对象 
    IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "//" + shortCutName + ".lnk");
    
    //设置快捷方式的目标所在的位置(源程序完整路径) 
    //shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
    shortcut.TargetPath = Application.StartupPath + @"\" + exeName;
    
    //应用程序的工作目录 
    //当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。 
    shortcut.WorkingDirectory = System.Environment.CurrentDirectory;
    
    //目标应用程序窗口类型(1.Normal window普通窗口,3.Maximized最大化窗口,7.Minimized最小化) 
    shortcut.WindowStyle = 1;
    
    //快捷方式的描述 
    shortcut.Description = "位置:" + Application.StartupPath;
    
    //可以自定义快捷方式图标.(如果不设置,则将默认源文件图标.) 
    //shortcut.IconLocation = System.Environment.SystemDirectory + "\\" + "shell32.dll, 165"; 
    
    //设置应用程序的启动参数(如果应用程序支持的话) 
    //shortcut.Arguments = "/myword /d4s"; 
    
    //设置快捷键(如果有必要的话.) 
    shortcut.Hotkey = "CTRL+ALT+D"; 
    
     //保存快捷方式 
     shortcut.Save();
    因为相信,所以我去做了......
  • 相关阅读:
    javascript性能
    图片及js的预加载
    url参数解析
    javascript预编译
    13、MVC 设计思想
    12、JDBC 流程
    线程-2、sleep() 、join()、yield()有什么区别
    线程-1、创建线程的方式及实现
    集合-7、HashMap实现原理及源码分析
    集合-6、HashSet 和 HashMap 区别
  • 原文地址:https://www.cnblogs.com/jeffqing/p/3036656.html
Copyright © 2011-2022 走看看