开发者

Win32API: how to create a shortcut (.lnk file)

I'm a Java developer, so please excuse my ignorance.

I want to create a shortcut to an executable, e.g., in the user's autostart or send-to folder (I d开发者_开发技巧on't want an installer to do that, because the installer usually is run by an administrator). What API (C preferred) I could use for that task (maybe using JNA)? Thanks in advance.


As @Hans indicated, it requires COM (via ShellLinkObject or WScript.Shell). In Java you can call COM objects using a Java to COM bridge. There are a few available, ranging from free to commercial. A couple that I know of are:

  • Java2COM
  • JACOB
  • JCOM


It requires using COM, ShellLinkObject from shell32.dll. No idea what that takes in Java, but you'll find C# code in my answer in this thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜