Win32API:如何创建快捷方式(.lnk 文件)

发布于 2024-09-28 21:31:33 字数 139 浏览 1 评论 0原文

我是一名Java开发人员,所以请原谅我的无知。

我想创建可执行文件的快捷方式,例如在用户的自动启动或发送文件夹中(我不希望安装程序这样做,因为安装程序通常由管理员运行)。我可以使用什么 API(首选 C)来完成该任务(也许使用 JNA)?提前致谢。

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 don'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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葵雨 2024-10-05 21:31:33

正如@Hans指出的,它需要COM(通过ShellLinkObject或WScript .Shell)。在 Java 中,您可以使用 Java 到 COM 的桥来调用 COM 对象。有一些可用的,从免费的到商业的。我知道的几个是:

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:

粉红×色少女 2024-10-05 21:31:33

它需要使用 shell32.dll 中的 COM、ShellLinkObject。不知道 Java 需要什么,但您会在我的答案中找到 C# 代码 此线程

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文