Win 7 固定到任务栏 + launch4j + NSIS
Win 7 pin to task bar + launch4j + NSIS
我们努力使名为 JabRef (http://jabref.sourceforge.net/) 的 Java Swing 应用程序可固定到 Windows 的任务栏。到目前为止我们做了什么:
- 通过 JNA 在 JabRef 中设置 AppModelUserID。我们通过output
验证了正确的值
- 使用 launch4j
构建 fat jar 并由此生成可执行文件 (exe)
- 使用 WinShell 插件通过 NSIS 创建安装程序
- 安装程序使用在 JabRef 中设置的相同 AppModelUserID 创建快捷方式。我们通过十六进制编辑器对此进行了验证。
- 分组有效:您可以通过快捷方式或 exe 启动
- 什么不起作用:右键单击任务栏项目只显示 "close application" 操作,没有别的。
知道如何进一步调试吗?
这显示了右键单击菜单。
如果固定的快捷方式不是 "taken over" 当您 运行 应用程序时,则 AppModelUserIDs 设置不正确。
您可以使用 this tool (shellproperty.exe read "System.AppUserModel.ID" from "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\MyApp.lnk"
)
验证 .lnk 中的 ID
在 运行ning 应用程序中,可以根据 window and/or 进程设置 AppModelUserID。查询这些对于外部应用程序有点困难,但您可以使用 GetCurrentProcessExplicitAppUserModelID
和 SHGetPropertyStoreForWindow
.
自行调用它们
如果 Windows 认为您的应用程序是托管应用程序,那么它将隐藏图钉菜单项,请参阅 Registering an Application as a Host Process. It looks like Java 应用程序已注册为主机进程。
If either the process itself or the shortcut file used to launch the
process has an explicit AppUserModelID, then the host process list is
ignored and the application is treated as a normal application by the
taskbar. The application's running windows are grouped together under
a single taskbar button and the application can be pinned to the
taskbar.
我唯一的建议是在您的启动器应用程序(如果它是一个单独的进程)和由 javaw.exe 托管的主应用程序中使用 JNA/JNI 来调用 SetCurrentProcessExplicitAppUserModelID
。
我们努力使名为 JabRef (http://jabref.sourceforge.net/) 的 Java Swing 应用程序可固定到 Windows 的任务栏。到目前为止我们做了什么:
- 通过 JNA 在 JabRef 中设置 AppModelUserID。我们通过output 验证了正确的值
- 使用 launch4j 构建 fat jar 并由此生成可执行文件 (exe)
- 使用 WinShell 插件通过 NSIS 创建安装程序
- 安装程序使用在 JabRef 中设置的相同 AppModelUserID 创建快捷方式。我们通过十六进制编辑器对此进行了验证。
- 分组有效:您可以通过快捷方式或 exe 启动
- 什么不起作用:右键单击任务栏项目只显示 "close application" 操作,没有别的。
知道如何进一步调试吗?
这显示了右键单击菜单。
如果固定的快捷方式不是 "taken over" 当您 运行 应用程序时,则 AppModelUserIDs 设置不正确。
您可以使用 this tool (shellproperty.exe read "System.AppUserModel.ID" from "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\MyApp.lnk"
)
在 运行ning 应用程序中,可以根据 window and/or 进程设置 AppModelUserID。查询这些对于外部应用程序有点困难,但您可以使用 GetCurrentProcessExplicitAppUserModelID
和 SHGetPropertyStoreForWindow
.
如果 Windows 认为您的应用程序是托管应用程序,那么它将隐藏图钉菜单项,请参阅 Registering an Application as a Host Process. It looks like Java 应用程序已注册为主机进程。
If either the process itself or the shortcut file used to launch the process has an explicit AppUserModelID, then the host process list is ignored and the application is treated as a normal application by the taskbar. The application's running windows are grouped together under a single taskbar button and the application can be pinned to the taskbar.
我唯一的建议是在您的启动器应用程序(如果它是一个单独的进程)和由 javaw.exe 托管的主应用程序中使用 JNA/JNI 来调用 SetCurrentProcessExplicitAppUserModelID
。