星空网 > 软件开发 > 操作系统

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

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

 

 

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

2. Jshortcut2

2.1. 提示新不上jshortcut.dll2

2.2. 使用win api实现3

2.3. 使用WshShell  com实现3

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

3. 4

4. Attilax的总结4

5. Ref4

6. Winapi 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 JShortcut. JShortcut 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 空格\AtiPlatf\WEB-INF\lib_dll\jshortcut.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

 




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

关键词:Windows

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

跨境电商选品注意事项:https://www.goluckyvip.com/tag/36467.html
跨境电商学费:https://www.goluckyvip.com/tag/36468.html
跨境电商学习:https://www.goluckyvip.com/tag/36469.html
跨境电商学习公众号:https://www.goluckyvip.com/tag/36470.html
跨境电商学习规划:https://www.goluckyvip.com/tag/36471.html
跨境电商学习计划:https://www.goluckyvip.com/tag/36472.html
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流