zoukankan      html  css  js  c++  java
  • Atitit.创建快捷方式 windows快捷方式的原理

    Atitit.创建快捷方式 windows快捷方式的原理

     

     

    1Windows中有2种快捷方式的文件:1

    2Jshortcut2

    2.1. 提示新不上jshortcut.dll2

    2.2. 使用win api实现3

    2.3. 使用WshShell  com实现3

    2.4. Win没提供cli格式的方法3

    34

    4Attilax的总结4

    5Ref4

    6Winapi code4

    7--end6

     

    1. Windows中有2种快捷方式的文件:

    1、快捷方式文件是二进制文件;

    2、Internet快捷方式文件,格式和INI文件一样,扩展名为 .URL。

     

    作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

    转载请注明来源: http://www.cnblogs.com/attilax/

     

     

     

    在此学习一下Internet快捷方式文件。

     

    Internet快捷方式的文件格式如下: 

    [DEFAULT]

    BASEURL=

     

    [InternetShortcut]

    URL=

    WorkingDirectory=

    ShowCommand=

    IconIndex=

    IconFile=

    Modified=

    HotKey=

     

    其中

    · BASEURL、URL和WorkingDirectory这3项的含义是不言而明的。

    · ShowCommand规定Internet Explorer启动后窗口的初始状态:7表示最小化,3表示最大化;如果没有ShowCommand这一项的话则表示正常大小。

    · IconFile和IconIndex用来为Internet快捷方式指定图标;如果你不想指定图标,Windows会使用缺省的Internet快捷方式图标。

    · HotKey指定一个整数值;HotKey的值及其含义见附录。

     

    2. Jshortcut

     

    JShortcut - A Java Native Interface (JNI) to …

    翻译此页

    This page contains information, documentation, and downloads for JShortcutJShortcut isa Java package with a native library that allows a Java application to create ...

     

     

    GitHub - jimmc jshortcut  Java JNI interface to access Windows shortcuts.htm

     

    http://alumnus.caltech.edu/~jimmc/jshortcut/download/index.html

    Jim McBeathhttp://www.alumni.caltech.edu/~jimmc

     

     

    2.1. 提示新不上jshortcut.dll

    Bg na feodg jshortcut.jar yda d dir hto...zo ok le ..

     

    Se,yeu tips  31bit d ,mafe ....give up..le..

    Exception in thread "main" java.lang.UnsatisfiedLinkError: D:workspace 空格AtiPlatfWEB-INFlib_dlljshortcut.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

    at java.lang.ClassLoader$NativeLibrary.load(Native Method)

    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)

    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1822)

    at java.lang.Runtime.load0(Runtime.java:809)

    at java.lang.System.load(System.java:1086)

    at net.jimmc.jshortcut.JShellLink.<clinit>(JShellLink.java:100)

    at com.attilax.util.ShortCut.createShortCut(ShortCut.java:31)

    at com.attilax.util.ShortCut.main(ShortCut.java:17)

     

     

    2.2. 使用win api实现

     

     

    用指定的类标识符创建一个Com对象,用指定的类标识符创建一个未初始化的对象。当在本机中只创建一个对象时,可以调用CoCreateInstance;在远程系统中创建一个对象时,可以调用CoCreateInstanceEx;创建多个同一CLSID的对象时可以参考CoGetClassObject 函数。

    2.3. 使用WshShell  com实现

    Set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    set oShellLink = WshShell.CreateShortcut(strDesktop & "学习天地.lnk")

     

    2.4. Win没提供cli格式的方法

     

    3.  

    4. Attilax的总结

    使用ini格式的url算兰..

    5. Ref

    java创建快捷方式(作者 ice古雨) - - ITeye技术网站.htm

    ()创建快捷方式到桌面的脚本命令_singularpoint_新浪博客.htm

    Internet快捷方式-vivieu-ChinaUnix博客.htm

    命令行创建快捷方式-vivieu-ChinaUnix博客.htm

    CoCreateInstance_百度百科.htm

    CoCreateInstance具体内部实现 - IT民工 博客频道 - CSDN.NET.htm

     

    6. Winapi code

     

      hr = CoCreateInstance(CLSID_ShellLink, NULL,
           CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pisl);

       IPersistFile* pIPF;

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////

    //这里是我们要创建快捷方式的原始文件地址
       pisl->SetPath("c:\windows\notepad.exe");
       hr = pisl->QueryInterface(IID_IPersistFile, (void**)&pIPF);
       if (SUCCEEDED(hr))
       {

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////

    //这里是我们要创建快捷方式的目标地址


        pIPF->Save(L"c:记事本.lnk", FALSE);
        pIPF->Release();

     

     

    h = CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,

    IID_IShellLink, (PVOID*)&shellLink );

    if (FAILED(h)) {

    errStr = "Failed to create IShellLink";

    goto err;

    }

     

    h = shellLink->QueryInterface(IID_IPersistFile, (PVOID*)&persistFile);

    if (FAILED(h)) {

    errStr = "Failed to get IPersistFile";

    goto err;

    }

     

     

    7. --end

  • 相关阅读:
    SQL Server Audit监控触发器状态
    SQL Server 数据变更时间戳(timestamp)在复制中的运用
    SQL Server 更改跟踪(Chang Tracking)监控表数据
    SQL Server 变更数据捕获(CDC)监控表数据
    SQL Server 事件通知(Event notifications)
    SQL Server 堆表行存储大小(Record Size)
    SQL Server DDL触发器运用
    SQL Server 默认跟踪(Default Trace)
    SQL Server 创建数据库邮件
    SQL Server 跨网段(跨机房)FTP复制
  • 原文地址:https://www.cnblogs.com/attilax/p/5259818.html
Copyright © 2011-2022 走看看